Submission #13124

#TimeUsernameProblemLanguageResultExecution timeMemory
13124gs14004탐사 (KOI13_probe)C++14
19 / 19
4 ms424 KiB
#include <cstdio> #include <algorithm> #include <cstring> using namespace std; int adj[50][50], k, n; int main(){ memset(adj,0x3f,sizeof(adj)); scanf("%d %d",&k,&n); for (int i=1; i<=k; i++) { adj[i][i+1] = 1; adj[i+1][i] = 0; adj[i][i] = 0; } for (int i=0; i<n; i++) { int x,y,z; scanf("%d %d %d",&x,&y,&z); adj[x][y+1] = min(adj[x][y+1],z); adj[y+1][x] = min(adj[y+1][x],-z); } for (int i=1; i<=k+1; i++) { for (int j=1; j<=k+1; j++) { for (int l=1; l<=k+1; l++) { adj[j][l] = min(adj[j][l],adj[j][i] + adj[i][l]); } } } for (int i=1; i<=k+1; i++) { if(adj[i][i] < 0){ puts("NONE"); return 0; } } for (int i=1; i<=k; i++) { if(adj[1][i+1] - adj[1][i]) putchar('#'); else putchar('-'); } }

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:18:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d %d %d",&x,&y,&z);
         ~~~~~^~~~~~~~~~~~~~~~~~~~~
#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...