# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
12921 | 2015-01-20T11:13:10 Z | baneling100 | 탐사 (KOI13_probe) | C++ | 2 ms | 424 KB |
#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
# | 결과 | 실행 시간 | 메모리 | 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 |
5 | Correct | 2 ms | 256 KB | Output is correct |
6 | Correct | 2 ms | 348 KB | Output is correct |
7 | Correct | 2 ms | 376 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 |
5 | Correct | 2 ms | 256 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 296 KB | Output is correct |
2 | Correct | 2 ms | 256 KB | Output is correct |
3 | Correct | 2 ms | 420 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 | 1 ms | 348 KB | Output is correct |
4 | Correct | 2 ms | 252 KB | Output is correct |
5 | Correct | 2 ms | 256 KB | Output is correct |
6 | Correct | 2 ms | 348 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 | 256 KB | Output is correct |
4 | Correct | 2 ms | 252 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 424 KB | Output is correct |
3 | Correct | 2 ms | 256 KB | Output is correct |
4 | Correct | 2 ms | 248 KB | Output is correct |