Submission #3313892
Source Code Expand
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
int n,to[25],handan[25],tof[25],num[25],ans[25],cnt,ac=-1,now[25],cq;
char name[25][25];
char op[25];
void x1(int v) {
if(v==n+1) {
int cc=0;cnt=0;cq=0;
for(int i=1;i<=n;++i) if(handan[i]==1) ++cc;
if(cc>ac) {
ac=cc;
for(int i=1;i<=ac;++i) if(handan[i]==1) ans[++cnt]=i;
for(int i=1;i<=ac;++i) for(int j=i+1;j<=ac;++j) if(strcmp(name[ans[i]],name[ans[j]])>0)
swap(ans[i],ans[j]);
}
else if(cc==ac) {
for(int i=1;i<=cc;++i) if(handan[i]==1) now[++cq]=i;
for(int i=1;i<=cc;++i) for(int j=i+1;j<=cc;++j) if(strcmp(name[now[i]],name[now[j]])>0) swap(now[i],now[j]);
for(int i=1;i<=cc;++i) if(strcmp(name[now[i]],name[ans[i]])<0) {
for(int i=1;i<=ac;++i) if(handan[i]==1) ans[++cnt]=i;break;
}
}
return;
}
int zs,zt;
if((handan[to[v]]==tof[v]||handan[to[v]]==2)&&(handan[v]==1||handan[v]==2)) {zt=handan[v];handan[v]=1;zs=handan[to[v]];handan[to[v]]=tof[v];x1(v+1);handan[to[v]]=zs;handan[v]=zt;}
if((handan[to[v]]!=tof[v]||handan[to[v]]==2)&&(!handan[v]||handan[v]==2)) {zt=handan[v];handan[v]=0;zs=handan[to[v]];handan[to[v]]=tof[v]^1;x1(v+1);handan[to[v]]=zs;handan[v]=zt;}
}
int main()
{
scanf("%d",&n);for(int i=1;i<=n;++i) handan[i]=2;
for(int i=1;i<=n;++i) scanf("%s",name[i]);
for(int i=1;i<=n;++i) {
scanf("%s",op);
for(int j=1;j<=n;++j) if(!strcmp(op,name[j])) {to[i]=j;break;}
scanf("%s%s%s",op,op,op);
if(!strcmp(op,"good")) tof[i]=1;
else tof[i]=0;scanf("%s",op);
}
x1(1);
if(ac==-1) puts("No answers");
else for(int i=1;i<=ac;++i) printf("%s\n",name[ans[i]]);
return 0;
}
Submission Info
Submission Time |
|
Task |
C - 酒場の冒険者たち |
User |
hy1004 |
Language |
C++ (GCC 5.4.1) |
Score |
0 |
Code Size |
1853 Byte |
Status |
WA |
Exec Time |
25 ms |
Memory |
128 KB |
Compile Error
./Main.cpp: In function ‘int main()’:
./Main.cpp:33:19: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
scanf("%d",&n);for(int i=1;i<=n;++i) handan[i]=2;
^
./Main.cpp:34:46: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
for(int i=1;i<=n;++i) scanf("%s",name[i]);
^
./Main.cpp:36:23: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
scanf("%s",op);
^
./Main.cpp:38:33: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
scanf("%s%s%s",op,op,op);
^
./Main.cpp:40:37: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_un...
Judge Result
Set Name |
All |
Score / Max Score |
0 / 100 |
Status |
|
Set Name |
Test Cases |
All |
00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt, 00_sample_03.txt, 01_max_00.txt, 01_max_01.txt, 05_corner_00.txt, 05_corner_01.txt, 05_corner_02.txt, 10_min_00.txt, 10_min_01.txt, 10_min_02.txt, 10_wrong_answer_00.txt, 20_max_00.txt, 20_max_01.txt, 20_max_02.txt, 90_random_00.txt, 90_random_01.txt, 90_random_02.txt, 90_random_03.txt, 90_random_04.txt, 90_random_05.txt, 90_random_06.txt, 90_random_07.txt, 90_random_08.txt, 90_random_09.txt, 99_medium_00.txt |
Case Name |
Status |
Exec Time |
Memory |
00_sample_00.txt |
AC |
1 ms |
128 KB |
00_sample_01.txt |
AC |
1 ms |
128 KB |
00_sample_02.txt |
AC |
1 ms |
128 KB |
00_sample_03.txt |
AC |
0 ms |
128 KB |
01_max_00.txt |
AC |
25 ms |
128 KB |
01_max_01.txt |
AC |
1 ms |
128 KB |
05_corner_00.txt |
WA |
1 ms |
128 KB |
05_corner_01.txt |
AC |
0 ms |
128 KB |
05_corner_02.txt |
WA |
0 ms |
128 KB |
10_min_00.txt |
WA |
0 ms |
128 KB |
10_min_01.txt |
WA |
0 ms |
128 KB |
10_min_02.txt |
AC |
0 ms |
128 KB |
10_wrong_answer_00.txt |
WA |
0 ms |
128 KB |
20_max_00.txt |
AC |
1 ms |
128 KB |
20_max_01.txt |
AC |
1 ms |
128 KB |
20_max_02.txt |
AC |
1 ms |
128 KB |
90_random_00.txt |
AC |
0 ms |
128 KB |
90_random_01.txt |
AC |
1 ms |
128 KB |
90_random_02.txt |
AC |
1 ms |
128 KB |
90_random_03.txt |
WA |
1 ms |
128 KB |
90_random_04.txt |
WA |
1 ms |
128 KB |
90_random_05.txt |
WA |
0 ms |
128 KB |
90_random_06.txt |
AC |
1 ms |
128 KB |
90_random_07.txt |
AC |
0 ms |
128 KB |
90_random_08.txt |
AC |
0 ms |
128 KB |
90_random_09.txt |
AC |
1 ms |
128 KB |
99_medium_00.txt |
AC |
1 ms |
128 KB |