QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#67138#5098. 第一代图灵机wzh20210 35ms3588kbC++14706b2022-12-10 09:56:072022-12-10 09:56:10

Judging History

This is the latest submission verdict.

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2022-12-10 09:56:10]
  • Judged
  • Verdict: 0
  • Time: 35ms
  • Memory: 3588kb
  • [2022-12-10 09:56:07]
  • Submitted

answer

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int N = 200010;
int n, m, q;
int a[N], c[N];
int cnt[N];
int main() {
	scanf("%d%d%d", &n, &m, &q);
	for (int i = 1; i <= n; ++i)
		scanf("%d", &a[i]);
	for (int i = 1; i <= n; ++i)
		scanf("%d", &c[i]);
	while (q--) {
		int opt, x, y;
		scanf("%d%d%d", &opt, &x, &y);
		if (opt == 1) {
			ll ans = 0, sum = 0;
			for (int i = x, j = x; i <= y; ++i) {
				for (; cnt[c[i]]; ++j) {
					--cnt[c[j]];
					sum -= a[j];
				}
				++cnt[c[i]];
				sum += a[i];
				ans = max(ans, sum);
			}
			for (int i = x; i <= y; ++i)
				cnt[i] = 0;
			printf("%lld\n", ans);
		} else
			c[x] = y;
	}
	return 0;
}

详细

Subtask #1:

score: 0
Wrong Answer

Test #1:

score: 0
Wrong Answer
time: 35ms
memory: 3588kb

input:

5000 200 5000
2315 3433 1793 4621 4627 4561 289 4399 3822 2392 392 4581 2643 2441 4572 4649 2981 3094 4206 2057 761 2516 2849 3509 3033 658 4965 3316 3269 4284 4961 753 1187 2515 1377 1725 4743 4761 3823 3464 4859 989 2401 953 875 1481 2181 103 2067 2625 3296 4721 61 3843 1607 997 4385 1284 4299 441...

output:

118571
74318
45735
37348
37348
37348
32544
29162
36207
36207
37348
32544
26119
26119
17541
22375
19459
22375
14075
24067
24288
24067
24042
17133
15958
24042
19380
22438
22438
23651
18950
22438
23843
24288
24288
22438
24288
22438
24288
5784
24288
23651
24288
23843
23843
23843
24288
23843
12690
24288
...

result:

wrong answer 2nd lines differ - expected: '90725', found: '74318'

Subtask #2:

score: 0
Time Limit Exceeded

Test #3:

score: 0
Time Limit Exceeded

input:

200000 10 200000
55651 97298 108697 86619 60721 199951 10610 162267 154301 138848 39191 18605 101369 57073 34977 101576 71252 143401 89587 160521 166491 38442 150761 35579 25571 121311 38033 38483 144639 41401 179161 54872 157905 137601 46863 187656 171901 43715 41036 150741 69057 102031 130561 4772...

output:

1232419
1001663
724483
707392
391689
391689
391689
391689
376312
391689
337980
338088
391689
391689
391689
391689
386231
344488
391689
199985
199985
199936
199985
199993
199673
199936
199993
199936
199985
199985
198805
199993
199993
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0...

result:


Subtask #3:

score: 0
Time Limit Exceeded

Test #5:

score: 0
Time Limit Exceeded

input:

200000 20000 200000
30681 32496 35471 48191 159123 69792 120915 150673 187226 158493 36275 26856 107976 124777 145229 69745 183961 14497 144808 153612 185893 137681 66417 46802 19345 113322 168046 128149 191001 135433 13201 139214 59489 81178 42343 163158 110121 119201 97501 53079 158755 192241 1132...

output:

46702944
32350110
27154123
24576993
17234135
24576993
21820387
23032997
42323113
33017592
11650120
21481715
20207008
25547635
23122169
16955798
20207008
16955798
20207008
20270018
21155673
21155673
14393463
14791128
32214916
31180789
31180789
12101388
18208095
26838038
20332018
17425702
27894547
237...

result:


Subtask #4:

score: 0
Skipped

Dependency #1:

0%

Subtask #5:

score: 0
Skipped

Dependency #4:

0%