fork download
  1. #include<bits/stdc++.h>
  2. typedef long long ll;
  3. using namespace std;
  4. const int N = 10000 + 5, M = 30 + 5;
  5.  
  6. struct submission {
  7. int p, s, t;
  8. bool ac;
  9. submission(int P=0, int S=0, int T=0, bool AC=false) {
  10. p=P, s=S, t=T, ac=AC;
  11. }
  12. bool operator < (const submission &o) const {
  13. return t < o.t;
  14. }
  15. } sub[N];
  16.  
  17. int firstAC[M], WAs[M][M], ACs[M];
  18. bool AC[M][M];
  19.  
  20. int main() {
  21. int n, m, k;
  22. int p, s, ac, t1, t2;
  23. int extreme, steadfast, solid, relentless;
  24. int t; scanf("%d", &t);
  25. while(t--) {
  26. scanf("%d%d%d", &n, &m, &k);
  27. swap(n, m);
  28. for(int i=0; i<k; ++i) {
  29. scanf("%d %d %d %d:%d", &p, &s, &ac, &t1, &t2);
  30. t1 = t1*60+t2;
  31. sub[i] = submission(p, s, t1, ac);
  32. }
  33. sort(sub, sub+k);
  34. memset(firstAC, -1, sizeof firstAC);
  35. memset(WAs, 0, sizeof WAs);
  36. memset(AC, 0, sizeof AC);
  37. memset(ACs, 0, sizeof ACs);
  38. extreme = steadfast = solid = relentless = -1;
  39. for(int i=0; i<k; ++i) {
  40. p = sub[i].p;
  41. s = sub[i].s;
  42. ac = sub[i].ac;
  43. if(ac) {
  44. if(firstAC[p] == -1)
  45. firstAC[p] = s;
  46. if(extreme == -1)
  47. extreme = s;
  48. steadfast = s;
  49. if(WAs[s][p] == 0)
  50. ++ACs[s];
  51. AC[s][p] = true;
  52. } else {
  53. ++WAs[s][p];
  54. }
  55. }
  56. int mxWA = -1;
  57. for(int i=1; i<=n; ++i)
  58. for(int j=1;j<=m;++j) {
  59. if(AC[i][j] && mxWA < WAs[i][j]) {
  60. mxWA = WAs[i][j];
  61. relentless = i;
  62. }
  63. }
  64. int mxAC = -1;
  65. for(int i=1; i<=n; ++i) {
  66. if(mxAC < ACs[i]) {
  67. mxAC = ACs[i];
  68. solid = i;
  69. }
  70. }
  71.  
  72. printf("%d", firstAC[1]);
  73. for(int i=2; i<=m; ++i)
  74. printf(" %d", firstAC[i]);
  75. puts("");
  76.  
  77. printf("%d %d %d %d\n", extreme, steadfast, solid, relentless);
  78. }
  79. return 0;
  80. }
Success #stdin #stdout 0s 4528KB
stdin
1
6 6 13
1 1 1 005:23
1 4 1 007:49
1 5 1 008:21
1 2 1 010:32
3 1 0 012:18
3 1 1 013:20
1 6 1 016:20
1 3 1 018:46
2 3 0 029:14
2 3 1 037:14
5 1 0 042:37
2 2 1 044:35
5 1 1 055:29
stdout
1 3 1 -1 1 -1
1 1 2 1