# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
975354 |
2024-05-05T02:29:11 Z |
vjudge1 |
Pizza (COCI21_pizza) |
C++17 |
|
1 ms |
600 KB |
#include <iostream>
#include <vector>
#include <algorithm>
#include <cstring>
using namespace std;
int memo[1000];
bool man(int x,vector <int> a){
if(memo[x]!=-1){
return memo[x];
}
else{
if(binary_search(a.begin(),a.end(),x)){
memo[x]=false;
return false;
}
memo[x]=true;
return true;
}
}
int main() {
memset(memo,-1,sizeof(memo));
int n,m,cnt=0;
cin>>n;
bool temp;
vector <int> a;
for(int i=0;i<n;i++){
int t;
cin>>t;
a.push_back(t);
}
sort(a.begin(),a.end());
cin>>m;
for(int i=0;i<m;i++){
int t;
cin>>t;
temp=true;
for(int j=0;j<t;j++){
int y;
cin>>y;
if(temp){
temp=man(y,a);
}
}
if(temp){
cnt++;
}
}
cout<<cnt;
}
# |
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 |
1 ms |
600 KB |
Output is correct |
2 |
Correct |
0 ms |
348 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 |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |