CSES - Putka Open 2020 – 2/5 - Results
Submission details
Task:Kortit
Sender:mangolassi
Submission time:2020-09-25 19:53:22 +0300
Language:C++ (C++11)
Status:READY
Result:0
Feedback
groupverdictscore
#10
#20
Test results
testverdicttimegroup
#10.01 s1, 2details
#20.01 s2details

Code

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

void solve() {
	int n;
	cin >> n;

	int res = 0, cur = 0, j = 1;
	for (int h = n/2; h; --h) {
		int i;
		cin >> i;
		while(i > j) {
			++j;
			++cur;
		}
		++j;

		if (cur > 0) {
			--cur;
			++res;
		}	
	}
	cout << res << '\n';
}

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);

	int t;
	cin >> t;
	for (int ti = 0; ti < t; ++ti) solve();
}

Test details

Test 1

Group: 1, 2

Verdict:

input
1000
2
1
6
2 4 5
...

correct output
0
2
0
2
1
...

user output
0
2
0
5
3
...
Truncated

Test 2

Group: 2

Verdict:

input
1000
70
56 23 58 70 2 57 27 61 47 3 42...

correct output
30
15
1
38
29
...

user output
35
16
1
48
35
...
Truncated