# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
923837 | Pring | Preokret (COCI18_preokret) | C++17 | 1 ms | 348 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
#ifdef MIKU
#define debug(x...) cout << '[' << #x << "] : ", dout(x)
void dout() { cout << endl; }
template <typename T, typename ...U>
void dout(T t, U ...u) { cout << t << (sizeof...(u) ? ", " : ""); dout(u...); }
#else
#define debug(...) 39
#endif
#define int long long
#define fs first
#define sc second
#define mp make_pair
#define FOR(i, j, k) for (int i = j, Z = k; i < Z; i++)
typedef pair<int, int> pii;
int n, m, br;
vector<pii> v;
int s1, s2;
int a1, a2;
void miku() {
cin >> n;
while (n--) {
cin >> br;
v.push_back(mp(br, 1LL));
}
cin >> m;
while (m--) {
cin >> br;
v.push_back(mp(br, 2LL));
}
sort(v.begin(), v.end());
n = v.size();
for (int i = 0, j = 0; i < n; i = j) {
while (j < n && v[i].sc == v[j].sc) j++;
bool f = (v[i].sc == 1 ? (s1 < s2) : (s1 > s2));
FOR(k, i, j) {
if (v[k].fs <= 1440) a1++;
(v[k].sc == 1 ? s1 : s2)++;
}
f &= (v[i].sc == 1 ? (s1 > s2) : (s1 < s2));
if (f) a2++;
}
cout << a1 << '\n' << a2 << '\n';
}
int32_t main() {
cin.tie(0) -> sync_with_stdio(false);
cin.exceptions(iostream::failbit);
miku();
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |