Submission #4278

#TimeUsernameProblemLanguageResultExecution timeMemory
4278club4208탐사 (KOI13_probe)C++98
19 / 19
2 ms384 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(){ scanf("%d %d", &n, &k); for(i=1;i<=n;i++) d[i]=INF; 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]) printf("#"); else printf("-"); } return 0; }

Compilation message (stderr)

probe.cpp: In function 'int main()':
probe.cpp:6: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:8:61: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     for(i=1;i<=k;i++) scanf("%d %d %d", &a[i], &b[i], &c[i]), a[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...