QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#336933#8287. Caught in the Middleucup-team1134#WA 1ms3620kbC++231.6kb2024-02-24 23:40:282024-02-24 23:40:28

Judging History

你现在查看的是最新测评结果

  • [2024-02-24 23:40:28]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3620kb
  • [2024-02-24 23:40:28]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return true; } return false; }
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define mp make_pair
#define si(x) int(x.size())
const int mod=998244353,MAX=300005,INF=1<<30;

map<string,bool> MA;
bool solve(string S){
    if(si(S)==0) return false;
    if(MA.count(S)) return MA[S];
    for(int i=0;i<si(S);i++){
        if(S[i]=='L'){
            if(!solve(S.substr(0,i))) return MA[S]=true;
        }else{
            if(!solve(S.substr(i+1))) return MA[S]=true;
        }
    }
    return MA[S]=false;
}

int main(){
    
    std::ifstream in("text.txt");
    std::cin.rdbuf(in.rdbuf());
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    for(int N=1;N<=10;N++){
        for(int bit=0;bit<(1<<N);bit++){
            string S;
            for(int i=0;i<N;i++){
                if(bit&(1<<i)) S+='L';
                else S+='R';
            }
            //if(!solve(S)) cout<<S<<endl;
        }
    }
    
    int Q;cin>>Q;
    while(Q--){
        int N;cin>>N;
        string S;cin>>S;
        if(N&1){
            cout<<"Alice\n";
        }else{
            bool f=true;
            int sum=0;
            for(char c:S){
                if(c=='R') sum++;
                else sum--;
                f&=(sum>=0);
            }
            if(f) cout<<"Bob\n";
            else cout<<"Alice\n";
        }
    }
}


詳細信息

Test #1:

score: 0
Wrong Answer
time: 1ms
memory: 3620kb

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:

Bob
Alice
Bob
Alice
Alice
Alice
Alice
Bob
Alice
Alice
Bob
Alice
Alice
Alice
Alice
Bob
Bob
Alice
Alice
Alice

result:

wrong answer 1st lines differ - expected: 'Alice', found: 'Bob'