이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#include <gondola.h>
using namespace std;
typedef vector<int> vi;
typedef vector<pair<int, int> > vpii;
typedef pair<int, int> pii;
typedef long long ll;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
typedef vector<ll> vll;
#define INF 0x3f3f3f3f
#define MOD 1000000007LL
#define EPSILON 0.00001
#define f first
#define s second
#define pb push_back
#define mp make_pair
#define FOR(i, a, b) for (ll i=(a); i<=(signed)(b); i++)
#define F0R(i, a) for (ll i=0; i<(signed)(a); i++)
#define RFOR(i, a, b) for (ll i=(a); i >= b; i--)
#define MN 100005
int rep[MN*2];
int valid(int n, int inputSeq[]){
F0R(i, n) rep[i] = rep[i+n] = inputSeq[i];
int loc = min_element(rep, rep+2*n)-rep;
F0R(i, n) inputSeq[i] = rep[i+loc];
set<int> hmm;
int v = -1;
if(inputSeq[0] <= n) v = inputSeq[0];
F0R(i, n){
if(hmm.count(rep[i])) return 0;
hmm.insert(rep[i]);
if(inputSeq[i]<=n && inputSeq[i]-i != v) return 0;
}
return 1;
}
int replacement(int n, int gondolaSeq[], int replacementSeq[]){
return 0;
}
int countReplacement(int n, int inputSeq[]){
return 0;
}
/*int main(){
ios_base::sync_with_stdio(false);
cin.tie(0);
int a[7] = {1, 2, 3, 4, 5, 6, 7};
int b[6] = {3, 4, 5, 6, 1, 2};
int c[7] = {1, 5, 3, 4, 2, 7, 6};
int d[4] = {4, 3, 2, 1};
int e[7] = {1, 2, 3, 4, 5, 6, 5};
int f[7] = {2, 3, 4, 9, 6, 7, 1};
int g[5] = {10, 4, 3, 11, 12};
cout << valid(7, a) << "\n";
cout << valid(6, b) << "\n";
cout << valid(7, c) << "\n";
cout << valid(4, d) << "\n";
cout << valid(7, e) << "\n";
cout << valid(7, f) << "\n";
cout << valid(5, g) << "\n";
return 0;
}*/
# | 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... |