QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#519262#7757. Palm IslandLuCiiiD#WA 2ms11448kbC++231.3kb2024-08-14 18:00:142024-08-14 18:00:15

Judging History

你现在查看的是最新测评结果

  • [2024-08-14 18:00:15]
  • 评测
  • 测评结果:WA
  • 用时:2ms
  • 内存:11448kb
  • [2024-08-14 18:00:14]
  • 提交

answer

#include <bits/stdc++.h>
#define _11037_ ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
#define endl '\n'
#define int long long
#define inf 4e18
#define MAX 1000005
using namespace std;
int T, N, b, a, book[MAX];
vector<int> arr;
void init(void)
{
    for (int i = 0; i < MAX; i++)
        book[i] = 0;
    arr.clear();
}
signed main()
{
    _11037_
    cin >> T;
    while (T--)
    {
        init();
        cin >> N;
        for (int i = 1; i <= N; i++)
            cin >> a, book[a] = i;
        for (int i = 1; i <= N; i++)
            cin >> b, arr.push_back(book[b]);
        for (int i = 0; i < N - 1; i++)
        {
            for (int j = i; j < N - 1; j++)
            {
                if (arr[0] > arr[1])
                    arr.push_back(arr[0]), arr.erase(arr.begin()), cout << "1";
                else
                    arr.push_back(arr[1]), arr.erase(arr.begin() + 1), cout << "2";
            }
            for (int j = 0; j < i; j++)
                arr.push_back(arr[1]), arr.erase(arr.begin() + 1), cout << "2";
            arr.push_back(arr[0]), arr.erase(arr.begin()), cout << "1";
        }
        arr.push_back(arr[0]), arr.erase(arr.begin()), cout << "1";
        /*   cout << endl;
          for (int i = 0; i < N; i++)
              cout << arr[i]; */
        cout << endl;
    }
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 2ms
memory: 11448kb

input:

2
3
1 2 3
2 3 1
4
1 2 3 4
2 1 3 4

output:

2111211
1221222122211

result:

wrong answer On Case#1: After your operations, a[1] = 3 but a[1] = 2. (test case 1)