QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#808846 | #8224. Caught in the Middle | OIer2008# | 0 | 1ms | 3976kb | C++14 | 1.2kb | 2024-12-11 08:11:51 | 2024-12-11 08:11:56 |
answer
#include<bits/stdc++.h>
#define fo(i,l,r) for(int i=l;i<=r;++i)
#define fd(i,r,l) for(int i=r;i>=l;--i)
#define ll long long
#define I inline int
#define V inline void
#define B inline bool
#define L inline ll
#define pi pair<int,int>
#define mk make_pair
#define fi first
#define se second
#define pb push_back
#define vi vector<int>
#define vii vector<pi>
using namespace std;
const int N=510,mod=998244353;
char St;
I read() {
int x=0,y=1;char c=getchar();
while(c<48||c>57) {if(c==45)y=-y;c=getchar();}
while(c>=48&&c<=57) x=(x<<1)+(x<<3)+(c^48),c=getchar();
return x*y;
}
int cnt[N],SG[N][N],n;
char c[N];
L ksm(ll x,int y) {ll t(1);for(;y;y>>=1,x=x*x%mod)if(y&1)t=t*x%mod;return t;}
V solve() {
n=read();
scanf("%s",c+1);
fo(i,1,n+1) SG[i][i-1]=0;
fo(len,1,n) {
fo(l,1,n-len+1) {
int r=l+len-1;
fo(i,l,r) {
if(c[i]=='L') cnt[SG[l][i-1]]++;
else cnt[SG[i+1][r]]++;
}
while(cnt[SG[l][r]]) SG[l][r]++;
fo(i,l,r) {
if(c[i]=='L') cnt[SG[l][i-1]]--;
else cnt[SG[i+1][r]]--;
}
}
}
if(SG[1][n]) puts("Alice");
else puts("Bob");
}
char Ed;
int main() {
cerr<<"memory:"<<(&St-&Ed)/1024.0<<endl;
int T=read();
while(T--) solve();
cerr<<"time:"<<clock()<<endl;
return 0;
}
詳細信息
Subtask #1:
score: 0
Wrong Answer
Test #1:
score: 0
Wrong Answer
time: 1ms
memory: 3976kb
input:
20 10 RLRRRRLLRR 10 LRLLLLRRLR 6 RLRLRL 10 LLRLRRRRLR 6 LRRLLL 3 RLR 5 LLRRR 6 RRRRRL 9 LRRRLRRLR 1 R 10 RRRLLRRLLL 6 LRLLLR 9 LLRLRLRLR 7 RRRRLRR 2 LL 10 RRRLLRRLRR 2 RL 7 RRLRRLR 3 LLR 10 LLRLRRRLLR
output:
Alice Alice Alice Alice Alice Alice Alice Alice Alice Alice Alice Alice Alice Alice Alice Alice Alice Alice Alice Alice
result:
wrong answer 3rd lines differ - expected: 'Bob', found: 'Alice'
Subtask #2:
score: 0
Skipped
Dependency #1:
0%
Subtask #3:
score: 0
Skipped
Dependency #1:
0%
Subtask #4:
score: 0
Skipped
Dependency #1:
0%