Submission #976383

# Submission time Handle Problem Language Result Execution time Memory
976383 2024-05-06T13:50:42 Z vjudge1 Pizza (COCI21_pizza) C++17
30 / 50
1 ms 348 KB
#include<bits/stdc++.h>
#define ll long long
#define nitro ios_base::sync_with_stdio;cin.tie(0);cout.tie(0);
using namespace std;

int n,m,k,ans=0;
int a[101],b[101];
bool binser(){
	bool temp=true;
	int low=1;
	int high=k;
	int mid;
	for(int i=1;i<=n;i++){
//		cout<<"cari "<<a[i]<<endl;
		while(low<=high&&temp==true){
//			cout<<b[mid]<<endl;
			mid=(low+high)/2;
			if(a[i]<b[mid]){
				high=mid-1;
			}
			else if(a[i]>b[mid]){
				low=mid+1;
			} 
			else if(a[i]==b[mid]){
				return false;
			}
		}
		low=1;
		high=k;
	}
	return true;
}


int main(){
	cin>>n;
	for(int i=1;i<=n;i++){
		cin>>a[i];
	}
	cin>>m;
	for(int i=1;i<=m;i++){
		cin>>k;
		for(int i=1;i<=k;i++){
			cin>>b[i];
		}
		if(binser()==true){
			ans++;
		}
	}
	cout<<ans;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct