Submission #00042


ソースコード

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
56
#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];
queue<long long int>Q[101];
bool flag[100001];
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;
flag[1] = true;
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 (dis[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:29:37
言語 C++11
状態 Wrong Answer
得点 0
ソースコード長 1258 Byte
最大実行時間 1000 ms
最大メモリ使用量 66156 KB

セット

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

テストケース

ファイル名 状態 実行時間 メモリ使用量 #
1.in WA 21 ms 2912 KB
1
2.in AC 21 ms 2896 KB
1
3.in WA 18 ms 2996 KB
1
4.in AC 20 ms 3544 KB
1
5.in AC 58 ms 9980 KB
1
6.in TLE 1000 ms 66156 KB
1