QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#137297 | #2358. What? Subtasks? Again? | freshmen# | WA | 2ms | 7804kb | C++14 | 810b | 2023-08-10 09:51:24 | 2023-08-10 09:51:26 |
Judging History
answer
#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<algorithm>
#include<cstdlib>
using namespace std;
int n,m,k,ls;
int c[200000],f[200000],ds[8],chk[200000][8],sur[200000],nb[8];
void dfs(int x){
if(x==6){
int ans=0;
for(int i=1;i<=5;++i){
if(ds[i]==1){
for(int j=1;j<=nb[i];++j){
sur[chk[j][i]]=1;
}
}
}
for(int i=1;i<=n;++i) if(sur[i]==0) ++ans;
if(ans<=m) ls=max(ls,ans);
for(int i=1;i<=5;++i){
if(ds[i]==1){
for(int j=1;j<=nb[i];++j){
sur[chk[j][i]]=0;
}
}
}
return;
}
ds[x]=0;dfs(x+1);ds[x]=1;dfs(x+1);
return;
}
int main(){
scanf("%d%d%d",&n,&m,&k);
for(int i=1;i<=k;++i){
scanf("%d%d",&c[i],&f[i]);
chk[++nb[f[i]]][f[i]]=c[i];
}
dfs(1);printf("%d\n",ls);
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 2ms
memory: 7804kb
input:
10 7 10 2 1 3 5 2 1 4 1 9 5 5 4 6 4 7 4 8 4 10 4
output:
6
result:
ok single line: '6'
Test #2:
score: -100
Wrong Answer
time: 1ms
memory: 5788kb
input:
10 9 0
output:
0
result:
wrong answer 1st lines differ - expected: 'Round will be unrated', found: '0'