# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
171271 | Adil | Preokret (COCI18_preokret) | C++14 | 8 ms | 504 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;
int n, m, a[3000], dp[3000], ans;
int main(){
cin >> n;
for(int i = 1; i <= n; i++){
int l;
cin >> l;
a[l] = 1;
}
cin >> m;
for(int i = 1; i <= m; i++){
int l;
cin >> l;
a[l] = 2;
}
int k1 = 0, k2 = 0;
for(int i = 1; i <= 2880; i++){
if(a[i] == 1){
k1++;
}
if(a[i] == 2){
k2++;
}
if(k1 == k2){
dp[i] = dp[i - 1];
}
else if(k1 < k2){
dp[i] = 2;
}
else{
dp[i] = 1;
}
if(i == 1440){
cout << k1 + k2 << "\n";
}
if((dp[i] == 1 && dp[i - 1] == 2) || (dp[i] == 2 && dp[i - 1] == 1)){
ans++;
}
}
cout << ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |