QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#55352#1171. Integer Array Shufflefeecle6418WA 2ms3632kbC++20423b2022-10-13 11:57:482022-10-13 11:57:49

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 11:57:49]
  • 评测
  • 测评结果:WA
  • 用时:2ms
  • 内存:3632kb
  • [2022-10-13 11:57:48]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int n,cnt=0;
int main(){
	cin>>n;
	deque<int> a(n),b(n);
	for(int i=0;i<n;i++)cin>>a[i];
	while(!is_sorted(a.begin(),a.end())){
		for(int i=0;i<n;i++){
			if(a.front()<a.back()){
				b.push_back(a.front());
				a.pop_front();
			}
			else {
				b.push_back(a.back());
				a.pop_back();
			}
		}
		swap(a,b);
		cnt++;
	}
	cout<<cnt;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 1ms
memory: 3488kb

input:

3
2 2 5

output:

0

result:

ok 1 number(s): "0"

Test #2:

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

input:

6
1 5 8 10 3 2

output:

1

result:

ok 1 number(s): "1"

Test #3:

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

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

input:

3
2 2 5

output:

0

result:

ok 1 number(s): "0"

Test #5:

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

input:

7
4 2 4 2 5 3 4

output:

2

result:

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