QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#771132 | #8046. Rock-Paper-Scissors Pyramid | caiwen | WA | 0ms | 3516kb | C++14 | 939b | 2024-11-22 10:03:25 | 2024-11-22 10:03:30 |
Judging History
answer
#include<bits/stdc++.h>
#define int long long
#define ull unsigned long long
#define ls(k) (k)<<1
#define rs(k) (k)<<1|1
#define debug(x) cout<<#x<<"="<<x<<endl
using namespace std;
const int inf=0x3f3f3f3f3f3f3f3f;
const int mod=0;
typedef pair<int,int> pii;
inline void subtask(){
deque<char> q;
string str;cin>>str;
int n=str.size();
q.push_front(str[0]);
for(int i=2;i<=n;i++){
char now=str[i-1],top=q.front();
if(
(now=='S'&&top=='P')||
(now=='P'&&top=='R')||
(now=='R'&&top=='S')
){
q.pop_front();
}
while(!q.empty()&&now==q.front()) q.pop_front();
q.push_front(now);
if(q.size()==3){
return cout<<q.back(),void();
}
}
cout<<q.back();
}
signed main(){
ios::sync_with_stdio(false);
int t;cin>>t;
while(t--) subtask();
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3516kb
input:
2 SPR SPSRRP
output:
SP
result:
wrong answer 1st lines differ - expected: 'S', found: 'SP'