Submission #1266466

#TimeUsernameProblemLanguageResultExecution timeMemory
1266466canhnam357Preokret (COCI18_preokret)C++20
50 / 50
0 ms328 KiB
// source problem : #include <bits/stdc++.h> using namespace std; #define all(x) x.begin(), x.end() #define int long long #define lb lower_bound #define ub upper_bound #define MASK(i) (1LL << (i)) const int inf = 1e18; void ckmax(int& f, int s) { f = (f > s ? f : s); } void ckmin(int& f, int s) { f = (f < s ? f : s); } int32_t main() { ios_base::sync_with_stdio(false); cin.tie(0); int n; cin >> n; vector<pair<int, int>> a; for (int i = 0; i < n; i++) { int x; cin >> x; a.emplace_back(x, 0); } cin >> n; for (int i = 0; i < n; i++) { int x; cin >> x; a.emplace_back(x, 1); } sort(all(a)); int f = 0, cnt[2]{}, s = 0; for (int i = 0; i < a.size(); i++) { if (a[i].first <= 2 * 12 * 60) f++; cnt[a[i].second]++; if (cnt[0] == cnt[1] && i + 1 < a.size() && a[i + 1].second == a[i].second) s++; } cout << f << '\n' << s; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...