Submission #99376

#TimeUsernameProblemLanguageResultExecution timeMemory
99376kimcodingPreokret (COCI18_preokret)C++17
50 / 50
3 ms384 KiB
#include <cstdio> int n, m; int score[2900][2]; int main() { int n; scanf("%d", &n); int ans1 = 0, ans2 = 0; for (int i = 1,x; i <= n; i++) { scanf("%d", &x); if (x <= 1440) ans1++; score[x][0]++; } scanf("%d", &m); for (int i = 1, x; i <= m; i++) { scanf("%d", &x); if (x <= 1440) ans1++; score[x][1]++; } int anow = 0, bnow = 0; bool awin = true, bwin = true; for (int i = 0; i < 2900; i++) { if (!score[i][0] && !score[i][1]) continue; anow += score[i][0]; bnow += score[i][1]; if (anow > bnow) { if (!awin) ans2++; awin = true, bwin = false; } if (bnow > anow) { if (!bwin) ans2++; bwin = true, awin = false; } } printf("%d\n%d\n", ans1, ans2); return 0; }

Compilation message (stderr)

preokret.cpp: In function 'int main()':
preokret.cpp:7:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  int n; scanf("%d", &n);
         ~~~~~^~~~~~~~~~
preokret.cpp:10:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d", &x);
   ~~~~~^~~~~~~~~~
preokret.cpp:14:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d", &m);
  ~~~~~^~~~~~~~~~
preokret.cpp:16:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d", &x);
   ~~~~~^~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...