QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#55389#1171. Integer Array Shufflefeecle6418WA 2ms3696kbC++20544b2022-10-13 15:13:172022-10-13 15:13:20

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2022-10-13 15:13:20]
  • 评测
  • 测评结果:WA
  • 用时:2ms
  • 内存:3696kb
  • [2022-10-13 15:13:17]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int n,cnt=0,a[300005];
bool Check(string s){
	for(int i=0,cur=1;i<s.size();i++){
		while(cur<n){
			if(s[i]=='0'&&a[cur+1]>=a[cur])cur++;
			else if(s[i]=='1'&&a[cur+1]<=a[cur])cur++;
			else break;
		}
		if(cur==n)return 1;
		cur++;
		if(cur==n)return 1;
	}
	return 0;
}
int main(){
	cin>>n;
	for(int i=1;i<=n;i++)cin>>a[i];
	string s="0";
	int cnt=0;
	while(!Check(s)){
		s=s+s,cnt++;
		for(int i=s.size()/2;i<s.size();i++)s[i]^=1;
	}
	cout<<cnt;
}

詳細信息

Test #1:

score: 100
Accepted
time: 2ms
memory: 3524kb

input:

3
2 2 5

output:

0

result:

ok 1 number(s): "0"

Test #2:

score: 0
Accepted
time: 0ms
memory: 3544kb

input:

6
1 5 8 10 3 2

output:

1

result:

ok 1 number(s): "1"

Test #3:

score: 0
Accepted
time: 1ms
memory: 3544kb

input:

8
14253630 18210471 431833031 681754868 791250850 811241570 837112104 858531105

output:

0

result:

ok 1 number(s): "0"

Test #4:

score: 0
Accepted
time: 2ms
memory: 3616kb

input:

3
2 2 5

output:

0

result:

ok 1 number(s): "0"

Test #5:

score: 0
Accepted
time: 2ms
memory: 3696kb

input:

7
4 2 4 2 5 3 4

output:

3

result:

ok 1 number(s): "3"

Test #6:

score: 0
Accepted
time: 2ms
memory: 3628kb

input:

8
92691902 57877007 167221695 197382747 709013587 643114183 962487887 112336349

output:

3

result:

ok 1 number(s): "3"

Test #7:

score: 0
Accepted
time: 1ms
memory: 3524kb

input:

8
14253630 811241570 18210471 431833031 858531105 837112104 681754868 791250850

output:

3

result:

ok 1 number(s): "3"

Test #8:

score: 0
Accepted
time: 2ms
memory: 3616kb

input:

8
1 1 1 1 1 1 1 1

output:

0

result:

ok 1 number(s): "0"

Test #9:

score: 0
Accepted
time: 2ms
memory: 3660kb

input:

8
858531105 837112104 811241570 791250850 681754868 431833031 18210471 14253630

output:

1

result:

ok 1 number(s): "1"

Test #10:

score: 0
Accepted
time: 2ms
memory: 3540kb

input:

8
1 2 2 2 2 1 1 1

output:

1

result:

ok 1 number(s): "1"

Test #11:

score: 0
Accepted
time: 0ms
memory: 3656kb

input:

2
802984614 842076689

output:

0

result:

ok 1 number(s): "0"

Test #12:

score: -100
Wrong Answer
time: 2ms
memory: 3468kb

input:

8
3 2 8 5 3 3 7 2

output:

2

result:

wrong answer 1st numbers differ - expected: '3', found: '2'