QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#356633#8298. Erasing Numberskevinyang#WA 0ms3820kbC++17904b2024-03-18 06:14:052024-03-18 06:14:05

Judging History

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

  • [2024-03-18 06:14:05]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3820kb
  • [2024-03-18 06:14:05]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
#define int long long
signed main(){
	cin.tie(nullptr)->sync_with_stdio(false);
	int t;
	cin >> t;
	while(t--){
		int n;
		cin >> n;
		vector<int>a(n+1);
		for(int i = 1; i<=n; i++){
			cin >> a[i];
		}
		for(int i = 1; i<=n; i++){
			vector<int>arr(n+1);
			if(a[i]==(n+1)/2){
				cout << "1";
				continue;
			}
			int rq = 0;
			if(a[i]<(n+1)/2){
				for(int j = 1; j<=n; j++){
					if(a[j]>a[i])arr[j] = 1;
				}
			}
			else{
				for(int j = 1; j<=n; j++){
					if(a[j]<a[i])arr[j] = 1;
				}
			}
			rq = abs((n+1)/2-a[i]);
			int cur = 0;
			for(int j = 1; j<=n; j++){
				if(arr[j] == 1){
					cur++;
					if(cur==3){
						rq--;
						cur = 1;
					}
				}
				else{
					cur = 0;
				}
			}
			if(rq<=0){
				cout << '1';
			}
			else{
				cout << '0';
			}
		}
		cout << '\n';
	}
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 3820kb

input:

2
5
3 1 2 5 4
3
2 3 1

output:

10001
100

result:

ok 2 lines

Test #2:

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

input:

1000
3
1 2 3
3
1 3 2
3
2 1 3
3
2 3 1
3
3 1 2
3
3 2 1
5
1 2 3 4 5
5
1 2 3 5 4
5
1 2 4 3 5
5
1 2 4 5 3
5
1 2 5 3 4
5
1 2 5 4 3
5
1 3 2 4 5
5
1 3 2 5 4
5
1 3 4 2 5
5
1 3 4 5 2
5
1 3 5 2 4
5
1 3 5 4 2
5
1 4 2 3 5
5
1 4 2 5 3
5
1 4 3 2 5
5
1 4 3 5 2
5
1 4 5 2 3
5
1 4 5 3 2
5
1 5 2 3 4
5
1 5 2 4 3
5
1 5 3...

output:

010
001
100
100
001
010
01110
01101
01010
01001
01010
01001
01010
01001
01000
01001
01000
01001
00010
00001
00100
00101
00001
00011
00010
00001
00100
00101
00001
00011
10110
10101
10010
10001
10010
10001
01010
01001
01000
11000
01000
11000
00010
00001
00100
10100
00001
10010
00010
00001
00100
10100
...

result:

wrong answer 130th lines differ - expected: '0111010', found: '0011010'