Task: | Kortit |
Sender: | AtskaFin |
Submission time: | 2020-09-25 19:19:58 +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 <iostream> #include <vector> #include <algorithm> #include <set> using namespace std; int n, half; vector<int> a; void f() { cin >> n; half = n/2; a.clear(); a.resize(half); for (int i = 0; i < half; i++) cin >> a[i]; sort(a.begin(), a.end()); int m = 0; int ia = 0; int points = 0; for (int i = 1; i <= n; i++) { if (a[ia] != i) { m++; } else { ia++; if (m > 0) { m--; points++; } } } cout << points << "\n"; } int t; int main() { cin >> t; for (int i = 0; i < t; i++) f(); }