Submission #00049
ソースコード
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 | #include "iostream" #include "climits" #include "list" #include "queue" #include "stack" #include "set" #include "functional" #include "algorithm" #include "math.h" #include "utility" #include "string" #include "map" #include "unordered_map" #include "iomanip" #include "random" using namespace std; const long long int MOD = 1000000007; long long int N, M, X; list< long long int >edge[1000001]; long long int dis[1000001]; queue< long long int >Q[101]; bool flag[1000001]; int main() { ios::sync_with_stdio( false ); cin >> N >> M >> X; for ( int i = 0; i < M; i++) { long long int a, b, c; cin >> a >> b >> c; edge[a].push_back(c*MOD + b); edge[b].push_back(c*MOD + a); } for ( int i = 2; i <= N; i++)dis[i] = 1000; dis[1] = 0; Q[0].push(1); for ( int i = 0; i <= X / 2; i++) { while (!Q[i].empty()) { long long int current = Q[i].front(); Q[i].pop(); if (flag[current]) continue ; flag[current] = true ; for (auto j : edge[current]) { if (dis[current] + j / MOD < dis[j%MOD]) { dis[j%MOD] = dis[current] + j / MOD; Q[dis[j%MOD]].push(j%MOD); } } } if (dis[N] * 2 > X)cout << "sleep\n" ; else cout << dis[N] * 2 << endl; return 0; } |
ステータス
項目 | データ |
---|---|
問題 | 0003 - 眠れる獅子の肝試し |
ユーザー名 | olphe |
投稿日時 | 2017-05-05 20:35:38 |
言語 | C++11 |
状態 | Compile Error |
得点 | 0 |
ソースコード長 | 1240 Byte |
最大実行時間 | - |
最大メモリ使用量 |
コンパイルメッセージ
./Main.cpp: In function ‘int main()’: ./Main.cpp:55:1: error: expected ‘}’ at end of input } ^
セット
セット | 得点 | Cases |
---|
テストケース
ファイル名 | 状態 | 実行時間 | メモリ使用量 | # |
---|