QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#404658#7757. Palm IslandAE12WA 1ms7844kbC++141.0kb2024-05-04 12:53:402024-05-04 12:53:40

Judging History

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

  • [2024-05-04 12:53:40]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:7844kb
  • [2024-05-04 12:53:40]
  • 提交

answer

#include<bits/stdc++.h>
#define IOS ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
//#define endl "\n"
//#define x first
//#define y second
//#define int long long
using namespace std;

typedef long long ll;
typedef pair<int , int> pii;
const int mod = 1e9 + 7;
const int N = 3e5 + 10;

int n, m;
int a[N], b[N], st[N], ne[N], pr[N], idx; 
inline void sovle(){
	cin >> n; 
	vector<int> o;
	for(int i = 1; i <= n; i ++) {
		cin >> a[i];
		o.push_back(a[i]);
	}
	for(int i = 1; i <= n; i ++) {
		cin >> b[i]; 
		st[b[i]] = i;
	}
	int s = 0;
	
	for(int k = 1; k <= n * n; k ++) {
		if(s >= n && st[o[0]] == 1) break; 
		if(st[o[0]] == n || b[st[o[0]] + 1] == o[1]) {
			o.push_back(o[0]);
			o.erase(o.begin());
			cout << 1; 
			s ++;
		} else {
			cout << 2;
			o.push_back(o[1]);
			o.erase(o.begin() + 1);
			s = 0;
		}
	}
//	cout << endl;
//	for(auto i : o) {
//		cout << i << " ";
//	} 
//	cout << endl;
}
signed main(void){
    IOS;
    int t = 1;
    cin >> t;
    while(t --) sovle();
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

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

output:

111121111111

result:

wrong answer On Case#1: The lenght of your output is 12(exceed n*n = 9). (test case 1)