QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#329286#7757. Palm IslandOobugoOWA 1ms3864kbC++141.4kb2024-02-16 15:42:012024-02-16 15:42:02

Judging History

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

  • [2024-02-16 15:42:02]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3864kb
  • [2024-02-16 15:42:01]
  • 提交

answer

#include <bits/stdc++.h>

#define int long long
#define OobugoO_IOS std::ios::sync_with_stdio(false), std::cin.tie(nullptr)
#define X first
#define Y second
#define pii pair<int, int>
#define pll pair<long long, long long>

typedef long long ll;
typedef long double LD;

// using namespace std;

// const int mod = 998244353;
const int mod = 1e9 + 7;
const int N = 3005;
const int M = 210;
const LD eps = 1e-8;

void solve() {
    int n;  std::cin >> n;
    std::vector<int> a(n), b(n);
    for (int i = 0; i < n; i++) {
        std::cin >> a[i];
    }
    for (int i = 0; i < n; i++) {
        std::cin >> b[i];
    }
    int st = 0;
    for (int i = 1; i < n; i++) {
        while (a[st] != b[i-1]) {
            std::cout << 1;
            a.push_back(a[st++]);
        }
        int nex = st + 1;
        while (a[nex] != b[i]) {
            std::cout << 2;
            a.push_back(a[nex++]);
        }
        std::cout << 1;
        a.push_back(a[st]);
        st = nex;
    }
    while(a[st] != b[0]) {
        std::cout << 1;
        a.push_back(a[st++]);
    }
    std::cout << '\n';
} 

signed main() {

#ifdef Onlion_Judge
    freopen("IO/input.in", "r", stdin);
    freopen("IO/output.out", "w", stdout);
#endif

    OobugoO_IOS;
    int t = 1;  std::cin>>t;
    while (t--) {
        solve();
    }
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 1ms
memory: 3864kb

input:

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

output:

1111
1221111

result:

ok Correct. (2 test cases)

Test #2:

score: -100
Wrong Answer
time: 0ms
memory: 3852kb

input:

200
3
3 1 2
2 3 1
4
2 4 1 3
2 1 4 3
4
1 4 2 3
2 1 3 4
5
4 3 2 1 5
2 4 5 3 1
5
2 1 5 4 3
5 2 4 1 3
4
4 3 1 2
1 2 4 3
3
1 2 3
3 1 2
4
1 4 2 3
2 1 4 3
4
1 3 2 4
1 4 3 2
3
3 2 1
1 3 2
3
2 3 1
1 3 2
4
1 4 3 2
3 1 2 4
3
1 2 3
1 3 2
3
3 2 1
2 3 1
5
5 1 3 2 4
2 4 5 1 3
4
4 3 1 2
1 4 3 2
4
1 3 4 2
2 4 3 1
3
...

output:

11111
21212111
1121212111
1122122121111
1122121221211
111111
11111
1121111
221111
11111
112111
1121212111
2111
12111
11111111
1121111
111221212111
1111
1111
11122121121111
111221111
11221212111
11121212111
121212111
11122112122111
1111
2121221211
11121121111
111221111
211111
2111
111221212111
12111
...

result:

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