This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
#include "gondola.h"
using namespace std;
int valid(int n, int inputSeq[]) {
int mn = 1010101010, sv = -1;
for (int i = 0; i < n; i++) {
if (mn > inputSeq[i]) {
mn = inputSeq[i];
sv = i;
}
}
if (mn > n)return 1;
int go = mn;
for (int i = sv - 1; i >= 0; i--) {
go--;
if (go < 1)go += n;
if (inputSeq[i] > n)continue;
if (inputSeq[i] != go)return 0;
}
for (int i = n - 1; i > sv; i--) {
go--;
if (go < 1)go += n;
if (inputSeq[i] > n)continue;
if (inputSeq[i] != go)return 0;
}
return 1;
}
//----------------------
int replacement(int n, int gondolaSeq[], int replacementSeq[])
{
return -2;
}
//----------------------
int countReplacement(int n, int inputSeq[])
{
return -3;
}
/**
1
7
1 2 3 4 5 6 7
1
6
3 4 5 6 1 2
1
7
1 5 3 4 2 7 6
1
4
4 3 2 1
1
7
1 2 3 4 5 6 5
1
7
2 3 4 9 6 7 1
1
5
10 4 3 11 12
*/
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |