QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#55387#1171. Integer Array Shufflefeecle6418WA 2ms3624kbC++20703b2022-10-13 15:08:102022-10-13 15:08:13

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:08:13]
  • 评测
  • 测评结果:WA
  • 用时:2ms
  • 内存:3624kb
  • [2022-10-13 15:08:10]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int n,cnt=0,a[300005];
string my;
string norm(string s){
	string t;
	for(int i=0,j;i<s.size();i=j+1){
		j=i;
		while(j+1<s.size()&&s[j+1]==s[j])j++;
		t.push_back(s[i]);
	}
	return t;
}
bool Check(string s){
	string u=norm(s),v=my;
	for(int i=0,j=0;i<v.size();i++){
		while(j<u.size()&&u[j]!=v[i])j++;
		if(j==u.size())return 0;
		j++;
	}
	return 1;
}
int main(){
	cin>>n;
	for(int i=1;i<=n;i++)cin>>a[i];
	for(int i=1;i<n;i++)my.push_back(a[i]<=a[i+1]?'0':'1');
	my=norm(my);
	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: 3620kb

input:

3
2 2 5

output:

0

result:

ok 1 number(s): "0"

Test #2:

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

input:

6
1 5 8 10 3 2

output:

1

result:

ok 1 number(s): "1"

Test #3:

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

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: 3548kb

input:

3
2 2 5

output:

0

result:

ok 1 number(s): "0"

Test #5:

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

input:

7
4 2 4 2 5 3 4

output:

4

result:

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