QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#618785 | #7757. Palm Island | shengZzz | WA | 0ms | 3592kb | C++20 | 1.2kb | 2024-10-07 10:18:15 | 2024-10-07 10:18:17 |
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);
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;
}
}
if(ans==" "){
cout<<endl;
return;
}
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;
}
详细
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3592kb
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)