Submission #171253

#TimeUsernameProblemLanguageResultExecution timeMemory
171253makotakoPreokret (COCI18_preokret)C++14
35.40 / 50
4 ms504 KiB
#include<bits/stdc++.h> #define ll long long #define F first #define S second #define pb push_back #define pp pop_back #define pii pair<int, int> #define pll pair<ll, ll> #define N int(1e5) + 5 #define T int(1e4) + 55 #define H int(1e3) + 55 using namespace std; ll n, m, a[H], s[H], sum, num, sam, nam; int main() { cin >> n; for(int i = 1;i <= n; ++ i) { cin >> a[i]; if(a[i] <= 24 * 60) { sum ++; } } cin >> m; for(int i = 1;i <= m; ++ i) { cin >> s[i]; if(s[i] <= 24 * 60) { sum ++; } } cout << sum << endl; sum = 0; sam = 1; nam = 1; ll sam1 = 0, nam1 = 0; while(sam <= n || nam <= m) { if(a[sam] < s[nam] && sam <= n) { sam ++; if(sam1 == 0 && nam1 == 0) { sam1 = 1; } else if(nam1 == 1 && sam > nam) { nam1 = 0; sam1 = 1; sum ++; } } else { nam ++; if(sam1 == 0 && nam1 == 0) { nam1 = 1; } else if(sam1 == 1 && nam > sam) { sam1 = 0; nam1 = 1; sum ++; } } } cout << sum; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...