Submission #16230

#TimeUsernameProblemLanguageResultExecution timeMemory
16230eaststar탐사 (KOI13_probe)C++14
19 / 19
3 ms376 KiB
#include <stdio.h> #include <algorithm> using namespace std; struct data{ int s,e,w; }a[1010]; int ans[41]; int main(){ int i,j,k,n; scanf("%d%d",&k,&n); for(i=1;i<=n;++i){ scanf("%d%d%d",&a[i].s,&a[i].e,&a[i].w); --a[i].s; } for(i=1;i<=k;++i)ans[i]=i; for(i=1;i<=k;++i){ for(j=0;j<k;++j){ ans[j+1]=min(ans[j+1],ans[j]+1); ans[j]=min(ans[j],ans[j+1]); } for(j=1;j<=n;++j){ ans[a[j].e]=min(ans[a[j].e],ans[a[j].s]+a[j].w); ans[a[j].s]=min(ans[a[j].s],ans[a[j].e]-a[j].w); } } for(i=1;i<=k;++i)if(ans[i]<0||ans[i]-ans[i-1]>1)break; if(i>k)for(i=1;i<=k;++i)printf("%c",ans[i]-ans[i-1]?'#':'-'); else puts("NONE"); return 0; }

Compilation message (stderr)

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