fork(2) download
  1. // div2a
  2. #include<bits/stdc++.h>
  3. using namespace std;
  4. const int nax = 1005;
  5. int n, c;
  6. int p[nax], t[nax];
  7.  
  8. int getScore() {
  9. int total = 0;
  10. int T = 0;
  11. for(int i = 0; i < n; ++i) {
  12. T += t[i];
  13. total += max(0, p[i] - T * c);
  14. }
  15. return total;
  16. }
  17. int main() {
  18. scanf("%d%d", &n, &c);
  19. for(int i = 0; i < n; ++i)
  20. scanf("%d", &p[i]);
  21. for(int i = 0; i < n; ++i)
  22. scanf("%d", &t[i]);
  23. int score1 = getScore();
  24. reverse(t, t + n);
  25. reverse(p, p + n);
  26. int score2 = getScore();
  27. if(score1 > score2) puts("Limak");
  28. else if(score1 < score2) puts("Radewoosh");
  29. else puts("Tie");
  30. return 0;
  31. }
  32.  
  33.  
  34. // div2B, code1
  35. #include<bits/stdc++.h>
  36. using namespace std;
  37. const int nax = 1e6 + 5;
  38. int t[nax];
  39. struct cmp {
  40. bool operator()(int a, int b) {
  41. return t[a] < t[b];
  42. }
  43. };
  44. int main() {
  45. int n, k, q;
  46. scanf("%d%d%d", &n, &k, &q);
  47. for(int i = 1; i <= n; ++i) scanf("%d", &t[i]);
  48. set<int, cmp> displayed;
  49. while(q--) {
  50. int type, a;
  51. scanf("%d%d", &type, &a);
  52. if(type == 1) {
  53. displayed.insert(a);
  54. if((int) displayed.size() > k)
  55. displayed.erase(displayed.begin());
  56. }
  57. else {
  58. if(displayed.find(a) == displayed.end())
  59. puts("NO");
  60. else
  61. puts("YES");
  62. }
  63. }
  64. return 0;
  65. }
  66.  
  67. // div2b, version2
  68. #include<bits/stdc++.h>
  69. using namespace std;
  70. const int nax = 1e6 + 5;
  71. int t[nax];
  72. int main() {
  73. int n, k, q;
  74. scanf("%d%d%d", &n, &k, &q);
  75. for(int i = 1; i <= n; ++i) scanf("%d", &t[i]);
  76. set<int> displayed;
  77. while(q--) {
  78. int type, a;
  79. scanf("%d%d", &type, &a);
  80. if(type == 1) {
  81. displayed.insert(a);
  82. if((int) displayed.size() > k) {
  83. int worst = *displayed.begin();
  84. for(int x : displayed)
  85. if(t[x] < t[worst])
  86. worst = x;
  87. displayed.erase(worst);
  88. }
  89. }
  90. else {
  91. if(displayed.find(a) == displayed.end())
  92. puts("NO");
  93. else
  94. puts("YES");
  95. }
  96. }
  97. return 0;
  98. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp:37:11: error: redefinition of 'const int nax'
 const int nax = 1e6 + 5;
           ^
prog.cpp:4:11: note: 'const int nax' previously defined here
 const int nax = 1005;
           ^
prog.cpp:38:10: error: redefinition of 'int t [1005]'
 int t[nax];
          ^
prog.cpp:6:13: note: 'int t [1005]' previously declared here
 int p[nax], t[nax];
             ^
prog.cpp: In function 'int main()':
prog.cpp:44:5: error: redefinition of 'int main()'
 int main() {
     ^
prog.cpp:17:5: note: 'int main()' previously defined here
 int main() {
     ^
prog.cpp: At global scope:
prog.cpp:70:11: error: redefinition of 'const int nax'
 const int nax = 1e6 + 5;
           ^
prog.cpp:4:11: note: 'const int nax' previously defined here
 const int nax = 1005;
           ^
prog.cpp:71:10: error: redefinition of 'int t [1005]'
 int t[nax];
          ^
prog.cpp:6:13: note: 'int t [1005]' previously declared here
 int p[nax], t[nax];
             ^
prog.cpp: In function 'int main()':
prog.cpp:72:5: error: redefinition of 'int main()'
 int main() {
     ^
prog.cpp:17:5: note: 'int main()' previously defined here
 int main() {
     ^
stdout
Standard output is empty