Submission #257766

#TimeUsernameProblemLanguageResultExecution timeMemory
257766HAjrhsaPreokret (COCI18_preokret)C++17
50 / 50
2 ms384 KiB
#include <bits/stdc++.h> using namespace std; void fst() { ios::sync_with_stdio(0); cin.tie(0); #ifndef ONLINE_JUDGE freopen("input.txt", "r", stdin); #endif } int pa[2881], pb[2881]; #define int long long int32_t main() { //fst(); int a, b; cin >> a ; int x; while (a--) { cin >> x; pa[x]++; } cin>>b; while (b--) { cin >> x; pb[x]++; } int prev = 0, turn = 0; for (int i = 1; i <= 2880; i++) { pa[i]+=pa[i-1]; pb[i]+=pb[i-1]; if (prev == 0) { if (pa[i] > pb[i]) prev = 1; else if (pa[i] < pb[i]) prev = 2; } if(prev==1 && pa[i]<pb[i]){prev=2;turn++;} if(prev==2 && pa[i]>pb[i]){prev=1;turn++;} } cout<<pa[1440]+pb[1440]<<"\n"<<turn<<"\n"; }

Compilation message (stderr)

preokret.cpp: In function 'void fst()':
preokret.cpp:9:9: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)', declared with attribute warn_unused_result [-Wunused-result]
  freopen("input.txt", "r", stdin);
  ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...