Task: | Kortit |
Sender: | mangolassi |
Submission time: | 2020-09-25 19:53:22 +0300 |
Language: | C++ (C++11) |
Status: | READY |
Result: | 0 |
group | verdict | score |
---|---|---|
#1 | WRONG ANSWER | 0 |
#2 | WRONG ANSWER | 0 |
test | verdict | time | group | |
---|---|---|---|---|
#1 | WRONG ANSWER | 0.01 s | 1, 2 | details |
#2 | WRONG ANSWER | 0.01 s | 2 | details |
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(); }