Submission #14285

#TimeUsernameProblemLanguageResultExecution timeMemory
14285tjdals1865탐사 (KOI13_probe)C++98
0 / 19
2100 ms396 KiB
#include <stdio.h> #include <stdlib.h> int len,robotcnt,robot[1000][4],i,thing[40],ans=0; int check(){ int j; for(j=0;j<robotcnt;j++) if(robot[j][2]<robot[j][3]) return 2; for(j=0;j<robotcnt;j++) if(robot[j][2]!=robot[j][3]) return 1; return 0; } void input(){ scanf("%d %d",&len,&robotcnt); for(i=0;i<robotcnt;i++) scanf("%d %d %d",&robot[i][0],&robot[i][1],&robot[i][2]); } void output(){ if(ans==1){ for(i=1;i<=len;i++){ if(thing[i]==0) printf("-"); else printf("*"); } } else printf("NONE"); } void process(int depth, int num){ if(depth==len+1) return; if(ans==1) return; thing[depth]=num; for(i=0;i<robotcnt;i++) if(robot[i][0]<=depth && depth<=robot[i][1] && num==1) robot[i][3]++; if(check()==2){ for(i=0;i<robotcnt;i++) if(robot[i][0]<=depth && depth<=robot[i][1] && num==1) robot[i][3]--; return; } else if(check()==1){ process(depth+1,1); process(depth+1,0); for(i=0;i<robotcnt;i++) if(robot[i][0]<=depth && depth<=robot[i][1] && num==1) robot[i][3]--; } else ans=1; } int main(void){ input(); process(1,1); process(1,0); output(); return 0; }

Compilation message (stderr)

probe.cpp: In function 'void input()':
probe.cpp:16:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d %d",&len,&robotcnt);
     ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
probe.cpp:18:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d %d %d",&robot[i][0],&robot[i][1],&robot[i][2]);
         ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...