QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#588480 | #2405. Tic-Tac State | Tenshi | WA | 0ms | 3832kb | C++20 | 1.4kb | 2024-09-25 11:57:39 | 2024-09-25 11:57:40 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
#define debug(x) cerr << #x << ": " << (x) << endl
#define rep(i,a,b) for(int i=(a);i<=(b);i++)
#define dwn(i,a,b) for(int i=(a);i>=(b);i--)
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define x first
#define y second
using pii = pair<int, int>;
using ll = long long;
inline void read(int &x){
int s=0; x=1;
char ch=getchar();
while(ch<'0' || ch>'9') {if(ch=='-')x=-1;ch=getchar();}
while(ch>='0' && ch<='9') s=(s<<3)+(s<<1)+ch-'0',ch=getchar();
x*=s;
}
vector<int> w;
int n;
bool ok(vector<int> g){
while(g.size()!=3) g.pb(0);
if(g[0]==7 || g[1]==7 || g[2]==7) return true;
if(g[0]>>2 && g[1]>>2 && g[2]>>2) return true;
if(g[0]>>1&1 && g[1]>>1&1 && g[2]>>1&1) return true;
if(g[0]&1 && g[1]&1 && g[2]&1) return true;
if(g[0]&1 && g[1]>>1&1 && g[2]>>2&1) return true;
if(g[0]>>2&1 && g[1]>>1&1 && g[2]&1) return true;
return false;
}
void solve(){
string s; cin>>s;
while(s.size()<7) s="0"+s;
n=s.size();
w.clear();
rep(i, 0, n-1) w.pb(s[i]-'0');
vector<int> a, b;
rep(i, n-3, n-1) a.pb(w[i]);
rep(i, n-3-3, n-3-1) b.pb(w[i]);
rep(i, 0, 3-1) a[i]^=b[i];
int st=0;
if(ok(a)) st=1;
else if(ok(b)) st=2;
if(!st){
if(s.substr(s.size()-3)=="777") puts("Cat’s");
else puts("In progress");
}
else puts(st==1? "O wins": "X wins");
}
signed main(){
int cs; cin>>cs;
while(cs--) solve();
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3832kb
input:
4 01116777 07037 01416777 050055
output:
O wins X wins Cat’s In progress
result:
wrong answer 3rd lines differ - expected: 'Cat's', found: 'Cat’s'