Submission #86830

# Submission time Handle Problem Language Result Execution time Memory
86830 2018-11-27T16:28:06 Z mayhoubsaleh Preokret (COCI18_preokret) C++14
50 / 50
4 ms 620 KB
#include <bits/stdc++.h>

using namespace std;

int n,m,a[3000],b[3000],x;
int now=3000;
void read(){
    cin>>n;
    cin>>x;
    now=min(now,x);
    a[x]++;
    for(int i=1;i<n;i++){
        cin>>x;
        a[x]++;
    }

    cin>>m;
    cin>>x;
    now=min(now,x);
    b[x]++;
    for(int i=1;i<m;i++){
        cin>>x;
        b[x]++;
    }
}
int ans;
int main(){
    read();
    for(int i=1;i<=2880;i++){
        a[i]+=a[i-1];
        b[i]+=b[i-1];
    }

    cout<<a[24*60]+b[24*60]<<endl;
    int i;
    while(now<=2880){
        if(a[now]>b[now]){
            for(i=now+1;i<=2880;i++){
                if(b[i]>a[i]){ans++;break;}
            }
        }
        else
        {
            for(i=now+1;i<=2880;i++){
                if(a[i]>b[i]){ans++;break;}
            }
        }
        now=i;
    }

    cout<<ans;
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 500 KB Output is correct
3 Correct 2 ms 500 KB Output is correct
4 Correct 3 ms 580 KB Output is correct
5 Correct 2 ms 604 KB Output is correct
6 Correct 3 ms 604 KB Output is correct
7 Correct 3 ms 604 KB Output is correct
8 Correct 4 ms 604 KB Output is correct
9 Correct 3 ms 612 KB Output is correct
10 Correct 2 ms 620 KB Output is correct