# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
147203 | 2019-08-28T12:01:56 Z | MatesV13 | Preokret (COCI18_preokret) | C++11 | 2 ms | 376 KB |
#include <bits/stdc++.h> using namespace std; int a[2881],b[2881],A, B, x, reza, rezb, vod, ok; int main (){ ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); cin>>A; for(int i=1;i<A+1;i++) {cin>>x;a[x]++;} cin>>B; for(int j=1;j<B+1;j++) {cin>>x;b[x]++;} x=0; for (int i=0;i<1441;i++){if(a[i])x++; if(b[i])x++;} for(int i=1;i<2881;i++){ if(a[i])reza++; if(b[i])rezb++; if (reza+rezb==1){if(reza) vod=1; else vod=2;} if (reza>rezb and vod==2){vod=1; ok++;} if (reza<rezb and vod==1){vod=2; ok++;} } cout << x << endl << ok; return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 376 KB | Output is correct |
3 | Correct | 2 ms | 376 KB | Output is correct |
4 | Correct | 2 ms | 376 KB | Output is correct |
5 | Correct | 2 ms | 376 KB | Output is correct |
6 | Correct | 2 ms | 376 KB | Output is correct |
7 | Correct | 2 ms | 376 KB | Output is correct |
8 | Correct | 2 ms | 376 KB | Output is correct |
9 | Correct | 2 ms | 376 KB | Output is correct |
10 | Correct | 2 ms | 376 KB | Output is correct |