Submission #971306

# Submission time Handle Problem Language Result Execution time Memory
971306 2024-04-28T11:06:44 Z vjudge1 Pizza (COCI21_pizza) C++17
50 / 50
1 ms 440 KB
#include<bits/stdc++.h>
using namespace std;
#define int long long

signed main(){
    int n;
    cin>>n;
    int larang[n+1];
    for(int t=1;t<=n;t++){
        cin>>larang[t];
    }
    int cnt=0;
    int tc;
    cin>>tc;
    while(tc--){
        int a;
        cin>>a;
        int angka[a+2];
        for(int d=1;d<=a;d++){
            cin>>angka[d];
        }
        bool hmm=true;
        sort(angka+1,angka+a+1);
        for(int y=1;y<=n;y++){
            int ans=1;
            int l=1,r=a;
            while(l<=r){
                int mid=(l+r)/2;
                if(angka[mid]<larang[y]){
                    l=mid+1;
                }
                else if(angka[mid]>=larang[y]){
                    r=mid-1;
                    ans=mid;
                }
            }
            if(angka[ans]==larang[y]){
                hmm=false;
                break;
            }
        }
        if(hmm==true)cnt++;
    }
    cout<<cnt<<endl;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 1 ms 432 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 1 ms 344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 1 ms 440 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 436 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct