QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#642155#7757. Palm IslandAuroraKelseyWA 1ms5664kbC++14941b2024-10-15 11:11:512024-10-15 11:11:53

Judging History

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

  • [2024-10-15 11:11:53]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:5664kb
  • [2024-10-15 11:11:51]
  • 提交

answer

#include <iostream>
#include <cstdio>
#include <vector>
#include <map>
#include <climits>


using namespace std;

const int N = 1000001;
int n;
int a[N], b[N];
map<int, int> mp;
bool check() {
    for(int i=1;i<=n;i++)
        if(a[i]!=b[i])
            return 0;
    return 1;
}
int main() {
    int t;
    cin >> t;
    while (t--) {
        cin >> n;
        for (int i = 1; i <= n; i++)
            cin >> a[i];
        for (int i = 1; i <= n; i++)
            cin>>b[i],mp[b[i]]=i;
        int j;
        int tmp;
        while(1){
           if(mp[a[1]]<mp[a[2]]) {
               tmp=a[2];
               j=2;
               cout<<2;
           }else{
               tmp=a[1];
               cout<<1;
               j=1;
           }
            for(int i=j;i<n;i++)
                a[i]=a[i+1];
            a[n]=tmp;
            if(check())break;
        }
    }


    return 0;
}


詳細信息

Test #1:

score: 0
Wrong Answer
time: 1ms
memory: 5664kb

input:

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

output:

1122

result:

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