QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#756084 | #9565. Birthday Gift | L_wwqq | WA | 0ms | 3576kb | C++20 | 781b | 2024-11-16 18:59:17 | 2024-11-16 18:59:17 |
Judging History
answer
#include<bits/stdc++.h>
#define int long long
#define i128 __int128
#define fi first
#define se second
#define all(a) begin(a)+1,end(a)
typedef unsigned long long ull;
using namespace std;
using pii = pair<int,int>;
using piii = pair<int,pii>;
const int N = 1e6+5;
int n,m,k;
inline void beez(){
string s;
cin >> s;
int n0 = 0,n1 = 0,n2 = 0;
bool ok = true;
for(auto it : s){
if(it == '2') n2 ++;
else if(it == '0' and ok) n0 ++;
else n1 ++;
ok = !ok;
}
int tmp = abs(n0 - n1);
if(tmp > n2) cout << tmp - n2 << "\n";
else {
tmp -= n2;
if(tmp & 1) cout << "1\n";
else cout << "0\n";
}
}
signed main(){
ios::sync_with_stdio(false);
cin.tie(nullptr);
int __=1;
cin>>__;
while(__--){
beez();
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3576kb
input:
5 0110101 01020102 0000021111 1012121010 0100202010
output:
5 0 2 6 2
result:
wrong answer 1st numbers differ - expected: '3', found: '5'