终于有场正常时间的比赛了。。。毛子换冬令时还正是好啊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 }
View Code

相关文章:

  • 2020-05-04
  • 2021-07-30
  • 2021-11-06
  • 2021-09-06
  • 2021-07-15
  • 2021-10-06
  • 2022-02-19
  • 2021-10-22
猜你喜欢
  • 2021-08-24
  • 2021-09-08
  • 2022-12-23
  • 2021-09-04
  • 2021-11-26
  • 2021-06-18
  • 2021-05-02
相关资源
相似解决方案