| # | Time | Username | Problem | Language | Result | Execution time | Memory | 
|---|---|---|---|---|---|---|---|
| 750481 | Trunkty | Preokret (COCI18_preokret) | C++14 | 1 ms | 384 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;
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 time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
