Submission #228935

#TimeUsernameProblemLanguageResultExecution timeMemory
228935VEGAnnPreokret (COCI18_preokret)C++14
50 / 50
5 ms384 KiB
#include <bits/stdc++.h> using namespace std; const int N = 3010; int ans = 0, vl[N], A, B; int main(){ ios_base::sync_with_stdio(0); cin.tie(0); cin >> A; for (int i = 0; i < A; i++){ int x; cin >> x; vl[x] = 1; } cin >> B; for (int i = 0; i < B; i++){ int x; cin >> x; vl[x] = -1; } for (int tim = 1; tim <= 1440; tim++) ans += abs(vl[tim]); cout << ans << '\n'; ans = 0; int lst = 0, cur = 0; for (int tim = 1; tim <= 2880; tim++){ cur += vl[tim]; if (cur != 0){ if (lst != 0){ if (lst > 0 && cur < 0) ans++; if (lst < 0 && cur > 0) ans++; } lst = cur; } } cout << ans; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...