QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#617881 | #7757. Palm Island | Moemi_ | WA | 0ms | 3812kb | C++20 | 1.6kb | 2024-10-06 17:30:37 | 2024-10-06 17:30:37 |
Judging History
answer
#include <iostream>
#include <cstring>
#include <algorithm>
#include <map>
#include <vector>
#include <set>
#include <queue>
#include <cmath>
#include <stack>
#include <cstring>
#include <iomanip>
#include <unordered_map>
#include <numeric>
#define sc_int(x) scanf("%d", &x)
#define x first
#define y second
#define pb push_back
using namespace std;
const int N = 110, M = 50, MOD = 1e9 + 7;
const int inf = 1e9;
typedef long long LL;
typedef unsigned long long ULL;
typedef pair<int, int> PII;
typedef pair<string, int> PSI;
typedef pair<LL, LL> PLL;
typedef pair<double, double> PDD;
typedef pair<char, int> PCI;
typedef pair<string, string> PSS;
int n, m;
void solve()
{
cin >> n;
vector<int> a(n), b(n), lef(n + 1);
deque<int> deq;
for(int i = 0; i < n; i ++) cin >> a[i], deq.push_back(a[i]);
for(int i = 0; i < n; i ++) cin >> b[i];
lef[b[0]] = b[n - 1];
for(int i = 1; i < n; i ++) lef[b[i]] = b[i - 1];
vector<int> res;
for(int i = 0; i < n; i ++)
{
auto t1 = deq.front();
deq.pop_front();
auto t2 = deq.front();
deq.pop_front();
while(lef[t2] != t1)
{
deq.pb(t2);
t2 = deq.front();
deq.pop_front();
res.pb(2);
}
res.pb(1);
deq.pb(t1);
res.pb(2);
deq.pb(t2);
}
if(deq.front() != b[0]) res.pb(1);
// cout << deq.front() << endl;
for(auto t : res) cout << t;
cout << endl;
}
int main()
{
// freopen("input.txt","r",stdin);
// freopen("output.txt","w",stdout);
// ios::sync_with_stdio(false),cin.tie(0),cout.tie(0);
int T = 1;
cin >> T;
while(T --)
{
solve();
}
}
詳細信息
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3812kb
input:
2 3 1 2 3 2 3 1 4 1 2 3 4 2 1 3 4
output:
1212121 2121212121
result:
wrong answer On Case#1: After your operations, a[1] = 1 but a[1] = 2. (test case 1)