Submission #00048


ソースコード

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;
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);
}
}
dis[current] = true;
}
}
if (dis[N] * 2 > X)cout << "sleep\n";
else cout << dis[N] * 2 << endl;
return 0;
}

ステータス

項目 データ
問題 0003 - 眠れる獅子の肝試し
ユーザー名 olphe
投稿日時 2017-05-05 20:34:24
言語 C++11
状態 Wrong Answer
得点 0
ソースコード長 1240 Byte
最大実行時間 856 ms
最大メモリ使用量 95076 KB

セット

セット 得点 Cases
1 ALL 0 / 100 *

テストケース

ファイル名 状態 実行時間 メモリ使用量 #
1.in WA 23 ms 24544 KB
1
2.in AC 23 ms 24452 KB
1
3.in WA 49 ms 24608 KB
1
4.in AC 29 ms 25332 KB
1
5.in AC 59 ms 31960 KB
1
6.in AC 856 ms 95076 KB
1