Submission #339594

#TimeUsernameProblemLanguageResultExecution timeMemory
339594ammar2000Preokret (COCI18_preokret)C++17
50 / 50
2 ms620 KiB
#include <bits/stdc++.h> using namespace std; int a,b,fh,cb; char cw='s'; map <int ,char> c; int main() { cin>>a; while (a--) { int y; cin>>y; if (y<=1440) fh++; c[y]='a'; } cin>>b; while (b--) { int y; cin>>y; if (y<=1440) fh++; c[y]='b'; } a=b=0; for (int i=1;i<=2888;i++) { if (c[i]=='a') a++; else if (c[i]=='b') b++; if (cw=='s') { if (a>b) cw='a'; else if (a<b) cw='b'; } else { if (a>b) { if (cw=='b') cb++; cw='a'; } else if (b>a) { if (cw=='a') cb++; cw='b'; } } } cout <<fh<<" "<<cb; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...