Task: | Kortit |
Sender: | ArktinenKarpalo |
Submission time: | 2020-09-25 18:06:20 +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> #define ll long long #define ull unsigned long long #define ld long double using namespace std; int k[111], n, t; int main() { cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0); cin >> t; for(int g=0; g<t; g++) { cin >> n; for(int i=1; i<=n; i++) k[i] = 0; int f; for(int i=0; i<n/2; i++) { cin >> f; k[f] = 1; } int m = 1; int v = n; int ans = 0; for(int i=0; i<n/2; i++) { while(k[v]) v--; while(!k[m]) m++; if(m>v) ans++; v--; m++; } cout << ans << "\n"; } }