QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#618798 | #7757. Palm Island | shengZzz | WA | 1ms | 3824kb | C++20 | 1.2kb | 2024-10-07 10:25:14 | 2024-10-07 10:25:15 |
Judging History
answer
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const int N = 2e5 + 9;
ll inf = 9223372036854775807;
void shift1(string &s){
string a=s.substr(1,s.length()-1);
char b=s[0];
s=a+b;
}
void shift2(string &s){
string a=s.substr(2,s.length()-1);
char b=s[0];
char c=s[1];
s=b+a+c;
}
void solve() {
int n;
cin>>n;
string a="a";
string b="a";
string ans="a";
for(int i=0;i<n;i++){
string c;
cin>>c;
a=a+c;
}
for(int i=0;i<n;i++){
string c;
cin>>c;
b=b+c;
}
a=a.substr(1,n);
b=b.substr(1,n);
if(a==b){
cout<<endl;
}
int flag=0;
int i=0;
int cnt=0;
while(a!=b){
if(b[i]!=a[flag] && flag==0){
shift1(a);
ans=ans+"1";
cout<<a<<endl;
}
else if(b[i]!=a[flag] && flag==1){
shift2(a);
ans=ans+"2";
cout<<a<<endl;
}
if(b[i]==a[flag]){
flag=1-flag;
i=(i+1)%n;
}
}
ans=ans.substr(1,ans.length()-1);
cout<<ans<<endl;
}
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
int T;
cin >> T;
while (T--) {
solve();
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 1ms
memory: 3824kb
input:
2 3 1 2 3 2 3 1 4 1 2 3 4 2 1 3 4
output:
231 1 2341 2413 2134 122
result:
wrong answer Line [name=s] equals to "231", doesn't correspond to pattern "[1-2]{0,1000000}" (test case 1)