用户输出
0
-2
系统信息
Exited with return code 0
编号 | 题目 | 状态 | 分数 | 总时间 | 内存 | 代码 / 答案文件 | 提交者 | 提交时间 |
---|---|---|---|---|---|---|---|---|
#20851 | #1066. 1-08E. cty的等式与不等式 | Accepted | 100 | 1337 ms | 1412 K | C++ / 1.0 K | wahahah | 2019-08-13 9:46:38 |
#include <bits/stdc++.h>
using namespace std;
int dis[505][505];
int main() {
memset(dis, 0x3f, sizeof(dis));
int i, j, k, n, m, q;
scanf("%d %d %d", &n, &m, &q);
for (i = 0; i < m; i++) {
int u, a, b, c;
scanf("%d %d %d %d", &u, &a, &b, &c);
if (u == 1) {
if (dis[b][a] > c) {
dis[b][a] = c;
}
}
if (u == 2) {
if (dis[a][b] > -c) {
dis[a][b] = -c;
}
if (dis[b][a] > c) {
dis[b][a] = c;
}
}
if (u == 3) {
if (dis[a][b] > -c) {
dis[a][b] = -c;
}
}
}
for (i = 1; i <= n; i++) {
dis[i][i] = 0;
}
for (k = 1; k <= n; k++) {
for (i = 1; i <= n; i++) {
for (j = 1; j <= n; j++) {
if (dis[i][j] > dis[i][k] + dis[k][j]) {
dis[i][j] = dis[i][k] + dis[k][j];
}
}
}
}
while (q--) {
int x, y;
scanf("%d %d", &x, &y);
printf("%d\n", dis[y][x]);
}
}
用户输出
0
-2
系统信息
Exited with return code 0
用户输出
7
8
系统信息
Exited with return code 0
500 10000 10000
3 70 305 -46729
3 140 433 -35103
1 454 442 51041
3 229 441 -88672
1 311 435 428
<255129 bytes omitted>
31678
35216
17803
21098
46380
16022
20680
32989
25696
46600
17717
41253
30447
40350
37
<69678 bytes omitted>
用户输出
31678
35216
17803
21098
46380
16022
20680
32989
25696
46600
17717
41253
30447
40350
37002
9251
38214
32357
49786
48186
48759
405
<59650 bytes omitted>
系统信息
Exited with return code 0
500 10000 10000
1 326 187 29339
3 238 241 -56713
3 15 178 -12531
3 401 37 -53317
1 466 45 10029
<255174 bytes omitted>
50802
39980
25832
48758
39534
49421
26670
29367
31494
10036
42953
25597
42118
9655
300
<69734 bytes omitted>
用户输出
50802
39980
25832
48758
39534
49421
26670
29367
31494
10036
42953
25597
42118
9655
30089
42814
43166
39745
32430
44494
18514
476
<59706 bytes omitted>
系统信息
Exited with return code 0
500 10000 10000
3 430 227 290
1 93 189 42205
3 173 316 -80378
3 405 306 -1852
3 447 337 -73619
<255044 bytes omitted>
27683
34262
38877
48498
36602
47321
36405
24844
26650
40405
19085
17746
24275
46974
29
<69495 bytes omitted>
用户输出
27683
34262
38877
48498
36602
47321
36405
24844
26650
40405
19085
17746
24275
46974
29174
26767
42604
35259
50451
20873
19468
22
<59467 bytes omitted>
系统信息
Exited with return code 0
500 10000 10000
1 301 54 62658
3 351 342 -53228
1 251 65 91564
1 30 51 53462
3 174 231 -42410
<255106 bytes omitted>
28970
39668
22803
16060
41803
26369
54625
27575
8457
23438
34774
32152
34101
32600
389
<69430 bytes omitted>
用户输出
28970
39668
22803
16060
41803
26369
54625
27575
8457
23438
34774
32152
34101
32600
38935
21431
36687
49707
41850
23171
13843
498
<59402 bytes omitted>
系统信息
Exited with return code 0
500 10000 10000
1 388 326 21698
1 291 128 32903
1 332 471 75628
1 369 463 33908
1 275 392 54883
<254889 bytes omitted>
13611
25815
12684
9825
41239
36365
49633
29539
23599
34858
36284
17044
17247
31461
261
<69399 bytes omitted>
用户输出
13611
25815
12684
9825
41239
36365
49633
29539
23599
34858
36284
17044
17247
31461
26123
42007
37324
57100
14740
5155
23495
2589
<59371 bytes omitted>
系统信息
Exited with return code 0
500 10000 10000
3 199 140 -32482
3 211 113 -5376
3 281 296 -28770
1 198 387 33129
3 39 281 -444
<254977 bytes omitted>
36631
10751
24293
24559
25446
32762
43906
34447
30775
34872
0
40015
28093
12508
18270
<69460 bytes omitted>
用户输出
36631
10751
24293
24559
25446
32762
43906
34447
30775
34872
0
40015
28093
12508
18270
27208
20682
17677
19306
34906
21891
43013
<59432 bytes omitted>
系统信息
Exited with return code 0
500 300 500
3 62 155 98
3 243 95 -731
1 57 172 -474
3 35 226 -776
3 41 233 -728
2 416 459 371
<8748 bytes omitted>
-1049
-735
-53
-70
-133
-1199
513
-354
493
-1193
-216
-2211
532
0
993
0
-210
0
0
<2433 bytes omitted>
用户输出
-1049
-735
-53
-70
-133
-1199
513
-354
493
-1193
-216
-2211
532
0
993
0
-210
0
0
-816
0
1995
328
-675
-1130
365
0
-843
-789
-368
<1905 bytes omitted>
系统信息
Exited with return code 0
500 300 500
2 481 84 -72
2 143 447 -110
3 289 167 940
2 112 453 420
1 274 265 95
3 221 42 712
<8771 bytes omitted>
-1176
-586
-703
877
0
-3327
785
-1507
-3327
-988
-3213
-846
506
298
503
121
-1467
-
<2638 bytes omitted>
用户输出
-1176
-586
-703
877
0
-3327
785
-1507
-3327
-988
-3213
-846
506
298
503
121
-1467
-1277
-553
-1382
-1536
-791
-549
-753
594
-582
<2110 bytes omitted>
系统信息
Exited with return code 0