Submission #750481

#TimeUsernameProblemLanguageResultExecution timeMemory
750481TrunktyPreokret (COCI18_preokret)C++14
50 / 50
1 ms384 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define int ll int a,b,ans1,ans2; int arr[3005]; signed main(){ ios::sync_with_stdio(false); cin.tie(NULL); cin >> a; for(int i=1;i<=a;i++){ int x; cin >> x; if(x<=1440){ ans1++; } arr[x]++; } cin >> b; for(int i=1;i<=b;i++){ int x; cin >> x; if(x<=1440){ ans1++; } arr[x]--; } int curr=0; for(int i=1;i<=3000;i++){ arr[i] += arr[i-1]; if(curr==0){ if(arr[i]>0){ curr = 1; } else if(arr[i]<0){ curr = -1; } } else if(arr[i]>0 and curr<0){ ans2++; curr = 1; } else if(arr[i]<0 and curr>0){ ans2++; curr = -1; } } cout << ans1 << "\n"; cout << ans2 << "\n"; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...