QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#402894#8287. Caught in the Middlewilly109WA 0ms3640kbC++201.2kb2024-05-01 17:19:462024-05-01 17:19:47

Judging History

This is the latest submission verdict.

  • [2024-05-01 17:19:47]
  • Judged
  • Verdict: WA
  • Time: 0ms
  • Memory: 3640kb
  • [2024-05-01 17:19:46]
  • Submitted

answer

#include <bits/stdc++.h>

#pragma GCC optimize("O3,unroll-loops")
#define pb push_back
#define F first
#define S second 
#define ld long double
#define all(a) a.begin(),a.end()
#define int long long 
#define pii pair <int,int>
#define sz(v) (int)v.size()
#define rep(i , a , b) for(int i=a;i <= (b);i++)
#define per(i , a , b) for(int i=a;i >= (b);i--)
#define deb(x) cout <<#x << " : " << x << "\n" ;
using namespace std ;
const int maxn = 4e5 + 10 , maxq = 32, inf = 1e9+10 , lg = 19  ,sq = 707 ,mod = 998244353 ;
int b[maxn] , sm[maxn] , a[maxn] , z[maxn] ,p[maxn] , sm2[maxn] ;

signed main(){
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    int T ;
    cin >> T ;
    while(T--){
        int n;cin >> n ;
        string s; 
        cin >> s ;
        int f =0 , ok =0 ;
        rep(i ,1 , n){
            if(s[i] == 'R')f++;
            else f--;
            if(f < 0)ok =1 ;
        }
        f =0 ;
        per(i , n , 1){
            if(s[i] == 'L')f++;
            else f--;
            if(f < 0)ok = 1; 
        }
        if(ok == 1){
            cout << "Alice\n";
        }else{
            cout << "Bob\n"; 
        }
    }    
    return 0 ;

}
/*


*/

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 3640kb

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'