Codeforces Round #279 (Div. 2) A. Team Olympiad 水题
#include<stdio.h> #include<iostream> #include<memory.h> #include<math.h> using namespace std; int flag1[5000]; int flag2[5000]; int flag3[5000]; int main() { memset(flag1,0,sizeof(flag1)); memset(flag2,0,sizeof(flag2)); memset(flag3,0,sizeof(flag3)); int n; cin>>n; int kiss,kiss1=0,kiss2=0,kiss3=0; int minn=1000000; for(int i=0;i<n;i++) { cin>>kiss; if(kiss==1) flag1[++kiss1]=i; else if(kiss==2) flag2[++kiss2]=i; else flag3[++kiss3]=i; } minn=min(kiss1,min(kiss2,kiss3)); cout<<minn<<endl; for(int i=0;i<minn;i++) { cout<<flag1[i+1]+1<<" "<<flag2[i+1]+1<<" "<<flag3[i+1]+1<<endl; } return 0; }