Submission #7413

#TimeUsernameProblemLanguageResultExecution timeMemory
7413gs13068탐사 (KOI13_probe)C++98
13.87 / 19
2 ms376 KiB
#include<cstdio> int a[41][41]; int main() { int x,y,r; int i,j,k,n,m; scanf("%d%d",&n,&m); for(i=0;i<=n;i++)for(j=0;j<=n;j++)if(i!=j)a[i][j]=1e9; for(i=0;i<n;i++) { a[i][i+1]=1; a[i+1][i]=0; } for(i=0;i<m;i++) { scanf("%d%d%d",&x,&y,&r); if(a[x-1][y]>r)a[x-1][y]=r; if(a[y][x-1]>-r)a[y][x-1]=-r; } for(k=0;k<=n;k++)for(i=0;i<=n;i++)for(j=0;j<=n;j++)if(a[i][j]>a[i][k]+a[k][j])a[i][j]=a[i][k]+a[k][j]; for(k=0;k<=n;k++)for(i=0;i<=n;i++)for(j=0;j<=n;j++)if(a[i][j]>a[i][k]+a[k][j]) { puts("NONE"); return 0; } for(i=1;i<=n;i++)putchar(a[0][i]-a[0][i-1]?'#':'-'); }

Compilation message (stderr)

probe.cpp: In function 'int main()':
probe.cpp:9:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d%d",&n,&m);
   ~~~~~^~~~~~~~~~~~~~
probe.cpp:18:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d%d%d",&x,&y,&r);
     ~~~~~^~~~~~~~~~~~~~~~~~~
#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...