# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
166058 | 2019-11-30T13:44:52 Z | itiam | Preokret (COCI18_preokret) | C++11 | 5 ms | 504 KB |
#include <iostream> #include <algorithm> #include <cstdio> using namespace std; int La[2283],Lb[2283]; int main(){ int Na,Nb,x,m=0,mm,pp=0,brop=0; //pp=prije poluvremena, brop=brojac preokreta, m=max, mm=minimal.. cin >> Na; for (int i=0;i<Na;i++){ cin >> x; if (x>m) m=x; if (x<mm || i==0) mm=x; if (x<=1440) pp+=1; La[x]=1; } cin >> Nb; for (int i=0;i<Nb;i++){ cin >> x; if (x>m) m=x; if (x<mm) mm=x; if (x<=1440) pp+=1; Lb[x]=1; } int p=0,pv; if (La[mm]==1) pv=-1; else if (Lb[mm]==1) pv=1; for (int i=mm;i<=m;i++){ if (La[i]==1){ p+=1; } else if (Lb[i]==1){ p-=1; } if (p*pv>0){ brop+=1; pv*=-1; } } cout << pp << "\n"; cout << brop; return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 380 KB | Output is correct |
3 | Partially correct | 2 ms | 376 KB | Output is partially correct |
4 | Runtime error | 2 ms | 376 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
5 | Partially correct | 2 ms | 380 KB | Output is partially correct |
6 | Runtime error | 3 ms | 376 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
7 | Runtime error | 3 ms | 376 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
8 | Runtime error | 5 ms | 504 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
9 | Runtime error | 3 ms | 380 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
10 | Correct | 2 ms | 376 KB | Output is correct |