终于有场正常时间的比赛了。。。毛子换冬令时还正是好啊233
做了ABCD,E WA了3次最后没搞定,F不会= =
那就来说说做的题目吧= =
A. Team Olympiad
水题嘛= =
就是个贪心什么的乱搞,貌似放A题难了
1 #include <cstdio> 2 #include <algorithm> 3 4 using namespace std; 5 const int N = 5005; 6 7 int cnt[5], first[5], next[N]; 8 9 int main() { 10 int n ,i, x, ans; 11 int a, b, c; 12 scanf("%d", &n); 13 for (i = 1; i <= n; ++i) { 14 scanf("%d", &x); 15 next[i] = first[x], first[x] = i; 16 ++cnt[x]; 17 } 18 ans = min(min(cnt[1], cnt[2]), cnt[3]); 19 printf("%d\n", ans); 20 a = first[1], b = first[2], c = first[3]; 21 for (i = 1; i <= ans; ++i) { 22 printf("%d %d %d\n", a, b, c); 23 a = next[a], b = next[b], c = next[c]; 24 } 25 }