Submission #12922

#TimeUsernameProblemLanguageResultExecution timeMemory
12922baneling100탐사 (KOI13_probe)C++98
19 / 19
4 ms380 KiB
#include <stdio.h> #include <algorithm> #include <vector> #define INF 0x7fffffff using namespace std; typedef pair <int,int> ppair; vector <ppair> Edge[41]; int K, N, Dist[41]; int main(void) { int i, j, k, l, in1, in2, in3, update; scanf("%d %d",&K,&N); for(i=1 ; i<=K ; i++) { Edge[i-1].push_back(make_pair(i ,1)); Edge[i ].push_back(make_pair(i-1,0)); Dist[i]=INF; } for(i=1 ; i<=N ; i++) { scanf("%d %d %d",&in1,&in2,&in3); in1--; Edge[in1].push_back(make_pair(in2,in3 )); Edge[in2].push_back(make_pair(in1,-in3)); } for(i=0 ; i<=K ; i++) { update=1; for(j=0 ; j<=K ; j++) { l=Edge[j].size(); for(k=0 ; k<l ; k++) if(Dist[Edge[j][k].first]>Dist[j]+Edge[j][k].second) { Dist[Edge[j][k].first]=Dist[j]+Edge[j][k].second; update=0; } } if(update) break; } if(Dist[0]<0) printf("NONE"); else for(i=1 ; i<=K ; i++) { if(Dist[i]-Dist[i-1]) printf("#"); else printf("-"); } return 0; }

Compilation message (stderr)

probe.cpp: In function 'int main()':
probe.cpp:16: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:23: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...