QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#178812#7118. Closing Timezhoukangyang#0 10ms53228kbC++111.4kb2023-09-14 13:57:052024-04-28 07:43:55

Judging History

你现在查看的是最新测评结果

  • [2024-04-28 07:43:55]
  • 管理员手动重测本题所有提交记录
  • 测评结果:0
  • 用时:10ms
  • 内存:53228kb
  • [2023-09-14 13:57:05]
  • 评测
  • 测评结果:0
  • 用时:12ms
  • 内存:52948kb
  • [2023-09-14 13:57:05]
  • 提交

answer

#include<bits/stdc++.h>
#define L(i, j, k) for(int i = (j); i <= (k); i++)
#define R(i, j, k) for(int i = (j); i >= (k); i--)
#define ll long long
#define ull unsigned long long 
#define sz(a) ((int) a.size())
#define vi vector<int>
#define me(a, x) memset(a, x, sizeof(a))
using namespace std;
const int N = 1 << 21, L = 5e5, mod = 998244353;
vector < pair < int, int > > e[N];
int n;
vector < ll > bfs(int x) {
	vector < ll > dis(n);
	L(i, 0, n - 1) {
		dis[i] = 2e18;
	}
	dis[x] = 0;
	queue < int > q;
	q.push(x);
	while(!q.empty()) {
		int u = q.front();
		q.pop();
		for(auto&v : e[u]) {
			if(dis[v.first] > dis[u] + v.second) {
				dis[v.first] = dis[u] + v.second;
				q.push(v.first);
			}
		}
	}
	return dis;
}
int max_score(int N, int X, int Y, ll K, vi U, vi V, vi W) {
	n = N;
	L(i, 0, N - 2) {
		e[U[i]].emplace_back(V[i], W[i]);
		e[V[i]].emplace_back(U[i], W[i]);
	} 
	auto dis1 = bfs(X);
	auto dis2 = bfs(Y);
	vector < ll > dp(2 * N + 1);
	L(i, 0, 2 * N) 
		dp[i] = 2e18;
	dp[0] = 0;
	L(i, 0, n - 1) 
		if(dis1[i] > dis2[i]) 
			swap(dis1[i], dis2[i]);
	L(i, 0, N - 1) {
		R(j, i * 2, 0) {
			dp[j + 2] = min(dp[j + 2], dp[j] + dis2[i]);
			dp[j + 1] = min(dp[j + 1], dp[j] + dis1[i]);
		}
	}
	int pos = 0;
	while(pos < 2 * N && dp[pos + 1] <= K) ++pos;
	return pos;
}

//int main() {
//	cout << max_score(7, 0, 2, 10,
// vi{0, 0, 1, 2, 2, 5}, vi{1, 3, 2, 4, 5, 6}, vi{2, 3, 4, 2, 5, 3}) << '\n';
//}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 0
Time Limit Exceeded

Test #1:

score: 0
Time Limit Exceeded

input:

cc61ad56a4797fb3f5c9529f73ce6fcedd85669b
1
200000 31011 61157 8517583098
31011 129396 964383
1655 129396 331139
1655 191487 566483
110385 191487 865248
43212 110385 542661
43212 81682 13766
81682 91774 546589
91774 124706 780638
124706 175650 118706
10421 175650 615314
10421 151953 436270
140430 151...

output:


result:


Subtask #2:

score: 0
Wrong Answer

Test #4:

score: 9
Accepted
time: 4ms
memory: 53216kb

input:

cc61ad56a4797fb3f5c9529f73ce6fcedd85669b
1
50 23 25 382806473
0 1 375710
1 2 898637
2 3 10402
3 4 536577
4 5 385023
5 6 71075
6 7 543368
7 8 301497
8 9 174394
9 10 711312
10 11 923006
11 12 675532
12 13 838667
13 14 565729
14 15 979816
15 16 862618
16 17 576015
17 18 177751
18 19 306989
19 20 881492...

output:

081ce3c351cbf526b37954b9ad30f2b531a7585c
OK
96

result:

ok 

Test #5:

score: 0
Accepted
time: 0ms
memory: 53228kb

input:

cc61ad56a4797fb3f5c9529f73ce6fcedd85669b
1
47 20 22 25669694
0 1 291237
1 2 851987
2 3 421247
3 4 962919
4 5 643085
5 6 224951
6 7 756890
7 8 147295
8 9 625823
9 10 736374
10 11 290526
11 12 335466
12 13 539086
13 14 957449
14 15 423408
15 16 932444
16 17 356032
17 18 307118
18 19 94279
19 20 989546...

output:

081ce3c351cbf526b37954b9ad30f2b531a7585c
OK
26

result:

ok 

Test #6:

score: 0
Accepted
time: 3ms
memory: 53024kb

input:

cc61ad56a4797fb3f5c9529f73ce6fcedd85669b
1
46 6 34 355277954
0 1 574359
1 2 58362
2 3 778155
3 4 538832
4 5 128903
5 6 79774
6 7 715282
7 8 259924
8 9 640303
9 10 361135
10 11 506866
11 12 527045
12 13 946672
13 14 620381
14 15 701743
15 16 766266
16 17 524732
17 18 340089
18 19 630172
19 20 357712
...

output:

081ce3c351cbf526b37954b9ad30f2b531a7585c
OK
74

result:

ok 

Test #7:

score: 0
Accepted
time: 3ms
memory: 52924kb

input:

cc61ad56a4797fb3f5c9529f73ce6fcedd85669b
1
45 14 44 70669
0 1 266130
1 2 372315
2 3 965349
3 4 119493
4 5 190522
5 6 506822
6 7 45330
7 8 423189
8 9 748532
9 10 653554
10 11 102552
11 12 90431
12 13 843259
13 14 422626
14 15 35334
15 16 1
16 17 1
17 18 1
18 19 1
19 20 1
20 21 1
21 22 1
22 23 1
23 24...

output:

081ce3c351cbf526b37954b9ad30f2b531a7585c
OK
4

result:

ok 

Test #8:

score: -9
Wrong Answer
time: 6ms
memory: 52924kb

input:

cc61ad56a4797fb3f5c9529f73ce6fcedd85669b
1
50 0 49 332340134
0 1 987193
1 2 950856
2 3 893737
3 4 870689
4 5 810192
5 6 790242
6 7 744052
7 8 714922
8 9 677074
9 10 630082
10 11 599644
11 12 528415
12 13 491648
13 14 479486
14 15 439182
15 16 371085
16 17 357776
17 18 308161
18 19 254481
19 20 20430...

output:

081ce3c351cbf526b37954b9ad30f2b531a7585c
OK
57

result:

wrong answer 1st lines differ - on the 1st token, expected: '44', found: '57'

Subtask #3:

score: 0
Skipped

Dependency #2:

0%

Subtask #4:

score: 0
Skipped

Dependency #3:

0%

Subtask #5:

score: 0
Wrong Answer

Test #36:

score: 9
Accepted
time: 4ms
memory: 53228kb

input:

cc61ad56a4797fb3f5c9529f73ce6fcedd85669b
1
4 0 1 9
0 2 2
1 2 3
2 3 3

output:

081ce3c351cbf526b37954b9ad30f2b531a7585c
OK
6

result:

ok 

Test #37:

score: 0
Accepted
time: 0ms
memory: 53008kb

input:

cc61ad56a4797fb3f5c9529f73ce6fcedd85669b
1
4 0 1 8
0 2 2
1 2 3
2 3 100

output:

081ce3c351cbf526b37954b9ad30f2b531a7585c
OK
5

result:

ok 

Test #38:

score: 0
Accepted
time: 3ms
memory: 52960kb

input:

cc61ad56a4797fb3f5c9529f73ce6fcedd85669b
1
8 0 4 84
0 1 1
1 2 29
2 3 29
3 4 1
4 5 20
2 6 20
3 7 1

output:

081ce3c351cbf526b37954b9ad30f2b531a7585c
OK
9

result:

ok 

Test #39:

score: 0
Accepted
time: 0ms
memory: 53216kb

input:

cc61ad56a4797fb3f5c9529f73ce6fcedd85669b
1
18 14 15 221112
8 10 15984
3 8 2664
6 10 5328
9 10 13320
5 10 23976
1 10 13320
3 4 5328
3 7 26640
3 11 23976
4 15 23976
6 17 18648
12 17 5328
11 13 13320
0 11 7992
15 16 5328
2 16 5328
13 14 2664

output:

081ce3c351cbf526b37954b9ad30f2b531a7585c
OK
14

result:

ok 

Test #40:

score: 0
Accepted
time: 10ms
memory: 53220kb

input:

cc61ad56a4797fb3f5c9529f73ce6fcedd85669b
1
19 3 9 11232111
13 14 174955
0 13 69982
10 14 209946
14 15 209946
12 14 104973
0 11 314919
0 3 314919
0 7 139964
5 10 209946
10 16 69982
4 10 104973
9 11 279928
9 17 349910
1 4 104973
3 18 209946
6 18 174955
7 8 314919
2 7 104973

output:

081ce3c351cbf526b37954b9ad30f2b531a7585c
OK
28

result:

ok 

Test #41:

score: 0
Accepted
time: 0ms
memory: 52992kb

input:

cc61ad56a4797fb3f5c9529f73ce6fcedd85669b
1
15 5 7 155966
1 4 964448
5 11 996819
9 10 330180
5 6 987448
11 12 704605
0 5 155967
8 14 596631
10 11 923917
0 14 560902
4 13 49411
1 7 856694
1 12 755799
2 14 488208
3 13 990480

output:

081ce3c351cbf526b37954b9ad30f2b531a7585c
OK
2

result:

ok 

Test #42:

score: 0
Accepted
time: 3ms
memory: 53184kb

input:

cc61ad56a4797fb3f5c9529f73ce6fcedd85669b
1
20 4 7 40726445
15 18 841797
9 16 909512
0 7 39919
8 19 78725
6 17 661904
7 14 426400
17 18 664669
7 13 917960
4 14 821652
4 11 274656
1 12 937782
10 19 129031
12 13 504353
5 11 502915
3 8 264525
2 19 358409
12 18 578659
16 19 696491
3 17 175157

output:

081ce3c351cbf526b37954b9ad30f2b531a7585c
OK
30

result:

ok 

Test #43:

score: 0
Accepted
time: 4ms
memory: 52924kb

input:

cc61ad56a4797fb3f5c9529f73ce6fcedd85669b
1
19 1 8 758761123780644886
3 18 947982
12 13 415218
3 15 890432
11 17 808801
2 8 726510
7 12 752493
8 17 328133
6 7 465830
8 14 126540
9 18 443041
1 7 605214
4 11 243452
9 10 106626
3 7 498126
1 4 39081
0 2 861168
5 15 69635
3 16 223395

output:

081ce3c351cbf526b37954b9ad30f2b531a7585c
OK
38

result:

ok 

Test #44:

score: -9
Wrong Answer
time: 8ms
memory: 52952kb

input:

cc61ad56a4797fb3f5c9529f73ce6fcedd85669b
1
18 4 10 8410500
14 16 912609
2 8 546082
2 12 129063
1 17 454917
15 17 85372
1 11 862697
4 11 428830
7 9 860609
8 10 119165
6 11 143393
14 17 789886
13 15 216341
4 5 56300
12 13 718046
0 7 354300
9 15 142154
1 3 310843

output:

081ce3c351cbf526b37954b9ad30f2b531a7585c
OK
14

result:

wrong answer 1st lines differ - on the 1st token, expected: '11', found: '14'

Subtask #6:

score: 0
Skipped

Dependency #2:

0%

Subtask #7:

score: 0
Skipped

Dependency #3:

0%

Subtask #8:

score: 0
Skipped

Dependency #4:

0%

Subtask #9:

score: 0
Skipped

Dependency #1:

0%