# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
384707 | 2021-04-02T05:58:08 Z | AdiZer0 | Preokret (COCI18_preokret) | C++17 | 3 ms | 492 KB |
#include <bits/stdc++.h> #define pb push_back #define whole(x) x.begin(), x.end() #define sz(x) (int)x.size() using namespace std; typedef long long ll; typedef long double ld; const int N = (int)1e5 + 7; const int INF = (int)1e9 + 7; const ll linf = (ll)1e18 + 1; int n, a[N]; int m, b[N]; int main() { scanf ("%d", &n); for (int i = 1; i <= n; ++i) scanf ("%d", a + i); scanf ("%d", &m); for (int i = 1; i <= m; ++i) scanf ("%d", b + i); int who = -1, p1 = 1; int half = 0, turn = 0; int numA = 0, numB = 0; for (int i = 1; i <= n;) { if (p1 <= m && a[i] < b[p1]) { if (a[i] <= 1440) ++half; numA++; ++i; } else { if (b[p1] <= 1440) ++half; numB++; ++p1; } if (who == -1) { if (numA > numB) who = 0; else who = 1; } else { if (who) { if (numA > numB) who = 0, ++turn; } else { if (numA < numB) who = 1, ++turn; } } } while (p1 <= m) { ++numB; if (who == -1) { if (numA > numB) who = 0; else who = 1; } else { if (who) { if (numA > numB) who = 0, ++turn; } else { if (numA < numB) who = 1, ++turn; } } ++p1; } printf ("%d\n%d\n", half, turn); return 0; } /* 6 15 30 35 55 60 2065 7 20 25 40 45 50 2070 2075 */
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Partially correct | 1 ms | 364 KB | Output is partially correct |
2 | Partially correct | 1 ms | 364 KB | Output is partially correct |
3 | Correct | 1 ms | 364 KB | Output is correct |
4 | Correct | 1 ms | 364 KB | Output is correct |
5 | Correct | 2 ms | 364 KB | Output is correct |
6 | Runtime error | 2 ms | 492 KB | Execution killed with signal 11 |
7 | Runtime error | 3 ms | 492 KB | Execution killed with signal 11 |
8 | Runtime error | 2 ms | 492 KB | Execution killed with signal 11 |
9 | Correct | 2 ms | 364 KB | Output is correct |
10 | Correct | 2 ms | 364 KB | Output is correct |