QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#723734 | #9565. Birthday Gift | ucup-team1196 | Compile Error | / | / | C++23 | 1.0kb | 2024-11-07 23:58:15 | 2024-11-07 23:58:15 |
Judging History
你现在查看的是最新测评结果
- [2024-11-08 00:03:28]
- hack成功,自动添加数据
- (/hack/1146)
- [2024-11-07 23:58:15]
- 评测
- 测评结果:Compile Error
- 用时:0ms
- 内存:0kb
- [2024-11-07 23:58:15]
- 提交
answer
#include <bits/stdc++.h>
using namespace std;
#define int long long
void solve() {
string s;
cin>>s;
int n=s.size();
if(n==1){
cout<<1<<"\n";
return;
}
if (t != 5) assert(n % 2 == 0);
stack<int>st;
for(int i=0;i<n;++i){
int x=s[i]-'0';
if(!st.empty() && x!=2 && st.top()==x){
st.pop();
}
else st.push(x);
}
vector<int>a;
while(!st.empty()){
a.push_back(st.top());
st.pop();
}
int sz=a.size();
int r[3]={0,0,0};
int cur=0;
for(int i=1;i<sz;i+=2){
if(a[i]==2) continue;
a[i]^=1;
}
for(int i=0;i<sz;++i) r[a[i]]++;
int ma=max(r[0],r[1]),mi=min(r[0],r[1]);
if(mi+r[2]>=ma){
int ans=r[0]+r[1]+r[2];
cout<<(ans&1)<<"\n";
}
else cout<<ma-mi-r[2]<<"\n";
}
signed main() {
std::ios::sync_with_stdio(false);
std::cin.tie(0);
int t = 1;
std::cin >> t;
for (int i = 1; i <= t; i++) {
solve(t);
}
}
Details
answer.code: In function ‘void solve()’: answer.code:16:9: error: ‘t’ was not declared in this scope 16 | if (t != 5) assert(n % 2 == 0); | ^ answer.code: In function ‘int main()’: answer.code:54:14: error: too many arguments to function ‘void solve()’ 54 | solve(t); | ~~~~~^~~ answer.code:7:6: note: declared here 7 | void solve() { | ^~~~~