Submission #88129

#TimeUsernameProblemLanguageResultExecution timeMemory
88129BabinSinkoPreokret (COCI18_preokret)C++14
50 / 50
3 ms812 KiB
#include <cstdio> #include <cstdlib> #include <cmath> #include <iostream> #include <cctype> #include <ctime> using namespace std; int na, a[2883], nb, b[2883], sol1, sol2, ba, bb, sl[2883], j; int main(){ cin >> na; for(int i = 0; i < na; i++){ cin >> a[i]; if (a[i] <= 1440) sol1 = sol1 + 1; } cin >> nb; for(int i = 0; i < nb; i++){ cin >> b[i]; if (b[i] <= 1440) sol1 = sol1 + 1; } for(int i = 1; i <= 2883; i++){ if (a[ba] == i){ sl[j] = 1; j = j + 1; ba = ba + 1; } if (b[bb] == i){ sl[j] = 2; j = j + 1; bb = bb + 1; } } ba = 0; bb = 0; for (int i = 0; i < (na + nb); i++){ if(sl[i] == 1){ ba = ba + 1; } if(sl[i] == 2){ bb = bb + 1; } if(ba == (bb - 1) and sl[i + 1] == 1 and sl[i + 2] == 1) sol2 = sol2 + 1; if(bb == (ba - 1) and sl[i + 1] == 2 and sl[i + 2] == 2) sol2 = sol2 + 1; } cout << sol1 << endl << sol2; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...