# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
3141 | 2013-08-26T07:47:18 Z | club4208 | 탐사 (KOI13_probe) | C++ | 3 ms | 376 KB |
#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(){ // freopen("input.txt", "r", stdin); // freopen("output.txt", "w", stdout); scanf("%d %d", &n, &k); for(i=1;i<=n;i++) d[i]=INF; d[0]=0; 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]==1) printf("#"); else printf("-"); } } return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 296 KB | Output is correct |
2 | Correct | 2 ms | 256 KB | Output is correct |
3 | Correct | 2 ms | 256 KB | Output is correct |
4 | Correct | 2 ms | 296 KB | Output is correct |
5 | Correct | 2 ms | 348 KB | Output is correct |
6 | Correct | 3 ms | 376 KB | Output is correct |
7 | Correct | 2 ms | 256 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 256 KB | Output is correct |
2 | Correct | 2 ms | 252 KB | Output is correct |
3 | Correct | 2 ms | 256 KB | Output is correct |
4 | Correct | 2 ms | 256 KB | Output is correct |
5 | Correct | 2 ms | 256 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 256 KB | Output is correct |
2 | Correct | 2 ms | 256 KB | Output is correct |
3 | Correct | 2 ms | 256 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 256 KB | Output is correct |
2 | Correct | 2 ms | 256 KB | Output is correct |
3 | Correct | 2 ms | 376 KB | Output is correct |
4 | Correct | 2 ms | 256 KB | Output is correct |
5 | Correct | 2 ms | 256 KB | Output is correct |
6 | Correct | 2 ms | 256 KB | Output is correct |
7 | Correct | 2 ms | 256 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 256 KB | Output is correct |
3 | Correct | 2 ms | 376 KB | Output is correct |
4 | Correct | 2 ms | 256 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 256 KB | Output is correct |
2 | Correct | 2 ms | 376 KB | Output is correct |
3 | Correct | 3 ms | 376 KB | Output is correct |
4 | Correct | 3 ms | 376 KB | Output is correct |