QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#297315#6630. Triangle CollectionA_programmer0 13ms5524kbC++17682b2024-01-04 10:36:352024-01-04 10:36:35

Judging History

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

  • [2024-01-04 10:36:35]
  • 评测
  • 测评结果:0
  • 用时:13ms
  • 内存:5524kb
  • [2024-01-04 10:36:35]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
const int maxn = 2e5 + 5;

int c[maxn];
ll C[maxn], P[maxn];

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0); 
	
	int n, q;
	cin >> n >> q;
	if (n > 2000) return 0;
	for (int i = 1; i <= n; i++) cin >> c[i];
	while (q--)
	{
		int l, d;
		cin >> l >> d;
		c[l] += d;
		
		for (int i = 1; i <= n; i++) C[i] = C[i - 1] + c[i], P[i] = 1e18;
		P[1] = c[1] / 3;
		for (int i = 1; i < n; i++)
		{
			P[i + 1] = min(P[i + 1], P[i] + c[i + 1] / 2);
			P[min(n, 2 * i - 1)] = min(P[min(n, 2 * i - 1)], (C[min(n, 2 * i - 1)] - P[i]) / 2);
		}
		cout << P[n] << "\n";
	}
	return 0;
}

详细

Subtask #1:

score: 0
Wrong Answer

Test #1:

score: 5
Accepted
time: 1ms
memory: 3452kb

input:

1 23
1485
1 -12
1 -30
1 -20
1 6
1 24
1 5
1 31
1 14
1 -34
1 -22
1 -45
1 37
1 46
1 9
1 22
1 -9
1 9
1 -46
1 -47
1 39
1 36
1 -36
1 50

output:

491
481
474
476
484
486
496
501
489
482
467
479
495
498
505
502
505
490
474
487
499
487
504

result:

ok 23 numbers

Test #2:

score: -5
Wrong Answer
time: 1ms
memory: 3452kb

input:

12 1
13 79 59 21 32 13 85 40 74 15 49 56
3 31

output:

178

result:

wrong answer 1st numbers differ - expected: '189', found: '178'

Subtask #2:

score: 0
Skipped

Dependency #1:

0%

Subtask #3:

score: 0
Wrong Answer

Test #28:

score: 0
Wrong Answer
time: 13ms
memory: 5524kb

input:

1999 2000
1 1 1 1 0 2 0 2 1 0 2 1 2 2 2 1 2 0 0 1 2 2 0 1 0 1 0 2 0 0 2 1 1 1 1 0 1 2 1 2 1 1 1 1 1 0 2 2 0 2 1 1 2 0 0 2 0 0 2 1 2 0 0 1 1 2 0 2 2 2 1 2 0 2 1 2 0 1 2 2 2 1 1 2 1 1 1 1 0 0 1 1 0 1 2 1 0 0 2 0 2 2 2 0 1 1 2 0 0 1 0 0 2 1 2 1 2 0 1 1 2 2 0 0 1 2 2 1 2 1 2 2 2 0 0 1 1 2 1 1 2 2 2 2 2 ...

output:

660
660
660
661
661
661
661
660
660
660
660
661
662
662
663
663
662
661
662
662
661
660
661
660
660
660
661
661
661
661
662
661
661
660
661
660
659
658
658
659
659
658
659
660
660
660
660
660
660
659
659
659
659
659
659
659
659
660
659
658
658
658
658
657
657
657
658
657
656
657
657
657
656
656
655
...

result:

wrong answer 1664th numbers differ - expected: '666', found: '665'

Subtask #4:

score: 0
Wrong Answer

Test #35:

score: 0
Wrong Answer
time: 12ms
memory: 3492kb

input:

2000 1999
0 1 0 3 0 1 0 0 0 0 0 0 0 2 0 0 0 0 3 1 1 0 2 0 0 3 0 0 0 0 0 4 0 0 1 0 1 0 0 0 0 1 2 1 0 0 0 0 7 0 1 3 1 0 1 1 0 3 2 1 0 1 1 3 3 1 0 2 0 0 0 0 0 0 0 0 1 0 0 0 2 0 0 0 0 0 1 2 3 0 1 0 3 3 0 0 0 0 1 0 1 2 0 0 2 2 0 1 2 1 2 0 0 0 1 1 0 1 2 0 0 0 0 2 0 5 0 0 0 0 0 1 0 0 2 0 1 2 0 1 0 0 0 2 0 ...

output:

664
665
664
665
664
665
664
665
664
664
664
664
664
664
663
664
664
664
664
664
663
664
664
664
664
665
665
665
665
665
665
665
665
665
665
665
665
665
665
666
666
666
666
666
665
665
665
665
665
665
665
665
665
665
665
665
665
665
665
665
665
666
666
666
666
666
665
665
665
666
665
666
665
665
665
...

result:

wrong answer 1st numbers differ - expected: '666', found: '664'

Subtask #5:

score: 0
Skipped

Dependency #1:

0%