Submission #3141

#TimeUsernameProblemLanguageResultExecution timeMemory
3141club4208탐사 (KOI13_probe)C++98
19 / 19
3 ms376 KiB
#include <stdio.h> #define INF 10000001 int a[1001],b[1001],d[1001],c[1001],n,k,i,j; int min(int a, int b){ if(a<b) return a; return b; } int main(){ // freopen("input.txt", "r", stdin); // freopen("output.txt", "w", stdout); scanf("%d %d", &n, &k); for(i=1;i<=n;i++) d[i]=INF; d[0]=0; for(i=1;i<=k;i++){ scanf("%d %d %d", &a[i], &b[i], &c[i]); a[i]--; } for(i=1;i<=n+1;i++){ for(j=0;j<n;j++){ if(d[j]!=INF) d[j+1]=min(d[j+1], d[j]+1); } for(j=0;j<n;j++){ if(d[j+1]!=INF) d[j]=min(d[j], d[j+1]); } for(j=1;j<=k;j++){ if(d[a[j]]!=INF) d[b[j]]=min(d[b[j]], d[a[j]]+c[j]); } for(j=1;j<=k;j++){ if(d[b[j]]!=INF) d[a[j]]=min(d[a[j]], d[b[j]]-c[j]); } } if(d[1]<0) printf("NONE"); else{ for(i=1;i<=n;i++){ if(d[i]-d[i-1]==1) printf("#"); else printf("-"); } } return 0; }

Compilation message (stderr)

probe.cpp: In function 'int main()':
probe.cpp:12:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d %d", &n, &k);
     ~~~~~^~~~~~~~~~~~~~~~~
probe.cpp:16:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d %d %d", &a[i], &b[i], &c[i]);
         ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#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...