Submission #12913

#TimeUsernameProblemLanguageResultExecution timeMemory
12913baneling100탐사 (KOI13_probe)C++98
14.63 / 19
2036 ms668 KiB
#include <stdio.h> int K, N, Probe[41][1001][3], Len[41], Ans[41]; int backTrack(int now) { int i, OK; if(now>K) return 1; else { Ans[now]=Ans[now-1]+1; OK=1; for(i=1 ; i<=Len[now] && OK ; i++) { if(now==Probe[now][i][2]) { if(Ans[now]-Ans[Probe[now][i][0]]!=Probe[now][i][1]) OK=0; } else if(Ans[now]-Ans[Probe[now][i][0]]>Probe[now][i][1]) OK=0; } if(OK) if(backTrack(now+1)) return 1; Ans[now]=Ans[now-1]; OK=1; for(i=1 ; i<=Len[now] && OK ; i++) { if(now==Probe[now][i][2]) { if(Ans[now]-Ans[Probe[now][i][0]]!=Probe[now][i][1]) OK=0; } else if(Ans[now]-Ans[Probe[now][i][0]]>Probe[now][i][1]) OK=0; } if(OK) if(backTrack(now+1)) return 1; } return 0; } int main(void) { int i, j, in1, in2, in3; scanf("%d %d",&K,&N); for(i=1 ; i<=N ; i++) { scanf("%d %d %d",&in1,&in2,&in3); for(j=in1 ; j<=in2 ; j++) { Len[j]++; Probe[j][Len[j]][0]=in1-1; Probe[j][Len[j]][1]=in3; Probe[j][Len[j]][2]=in2; } } if(backTrack(1)) for(i=1 ; i<=K ; i++) { if(Ans[i]-Ans[i-1]) printf("#"); else printf("-"); } else printf("NONE"); return 0; }

Compilation message (stderr)

probe.cpp: In function 'int main()':
probe.cpp:48:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d %d",&K,&N);
     ~~~~~^~~~~~~~~~~~~~~
probe.cpp:50:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d %d %d",&in1,&in2,&in3);
         ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
#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...