# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
319119 | daringtrifles | Gondola (IOI14_gondola) | C++17 | 0 ms | 0 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
//control+option+n to run!
#include <bits/stdc++.h>
#include "gondola.h"
using namespace std;
#define pb push_back
#define ll long long
#define pll pair<ll, ll>
#define FOR(i, a, b) for (signed long long i = (signed long long)(a); i < (signed long long)(b); i++)
#define NEGFOR(i, a, b) for (ll i = (a); i > (b); i--)
#define vll vector<long long>
#define sll set<long long>
#define ld long double
#define inf 1000000000000000000
#define mll multiset<long long>
#define vpll vector<pll>
#define nn << "\n"
#define ss << " "
#define F(i, b) for (ll i = 0; i < b; i++)
int valid(int n, int inputSeq[]){
ll mi=inf, curr=0;
FOR(i,0,n){
if(mi>inputSeq[i]){
curr=i;
}
mi=min(mi,(ll)inputSeq[i]);
}
ll past=mi-1;
FOR(i,curr,curr+n){
if (past+1==inputSeq[i%n]){
past++;
}
else return 0;
}
return 1;
}
//----------------------
int replacement(int n, int gondolaSeq[], int replacementSeq[])
{
return -2;
}
//----------------------
int countReplacement(int n, int inputSeq[])
{
return -3;
}
int main(){
int n; cin>>n; int x[n];
FOR(i,0,n) cin>>x[i];
cout<<valid (n,x);
}