Submission #00034
ソースコード
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 | #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[100001]; long long int dis[100001]; bool flag[100001]; set< long long int >S; 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] = INT_MAX; dis[1] = 0; S.insert(1); while (!S.empty()) { long long int current = *S.begin(); S.erase(S.begin()); if (flag[current%MOD]) continue ; flag[current%MOD] = true ; for (auto i : edge[current % MOD]) { if (dis[current % MOD] + i / MOD < dis[i % MOD]) { dis[i % MOD] = dis[current % MOD] + i / MOD; S.insert(dis[i % MOD] * MOD + i / MOD); } } } if (dis[N] * 2 > X)cout << "sleep\n" ; else cout << dis[N] * 2 << endl; return 0; } |
ステータス
項目 | データ |
---|---|
問題 | 0003 - 眠れる獅子の肝試し |
ユーザー名 | olphe |
投稿日時 | 2017-05-05 20:19:52 |
言語 | C++11 |
状態 | Wrong Answer |
得点 | 0 |
ソースコード長 | 1226 Byte |
最大実行時間 | 1000 ms |
最大メモリ使用量 | 66112 KB |
セット
セット | 得点 | Cases | |
---|---|---|---|
1 | ALL | 0 / 100 | * |
テストケース
ファイル名 | 状態 | 実行時間 | メモリ使用量 | # |
---|---|---|---|---|
1.in | AC | 15 ms | 2784 KB |
1
|
2.in | AC | 15 ms | 2960 KB |
1
|
3.in | WA | 24 ms | 2868 KB |
1
|
4.in | AC | 27 ms | 3488 KB |
1
|
5.in | AC | 39 ms | 9992 KB |
1
|
6.in | TLE | 1000 ms | 66112 KB |
1
|