# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
853032 | aykhn | Gondola (IOI14_gondola) | C++14 | 25 ms | 5916 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.
#include "gondola.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pb push_back
#define ins insert
#define infll 0x3F3F3F3F3F3F3F3F
#define inf 0x3F3F3F3F
#define pii pair<int, int>
#define pll pair<ll, ll>
#define mpr make_pair
#define all(v) v.begin(), v.end()
#define fi first
#define se second
int ok(vector<int> &v)
{
int n = v.size();
set<int> s;
for (int x : v) s.ins(x);
if (s.size() != v.size()) return 0;
vector<int> a(n, 0);
int anc = -1;
for (int i = 0; i < v.size(); i++)
{
if (v[i] <= n)
{
anc = i;
break;
}
}
if (anc == -1) return 1;
int shift = n + v[anc] - anc - 1;
for (int i = 0; i < n; i++) a[(i + shift + 10*n) % n] = v[i];
for (int i = 0; i < n; i++)
{
if (a[i] <= n && a[i] != i + 1) return 0;
}
return 1;
}
int valid(int n, int in[])
{
vector<int> v;
for (int i = 0; i < n; i++) v.pb(in[i]);
return ok(v);
}
int replacement(int n, int in[], int ret[])
{
return -1;
}
int countReplacement(int n, int in[])
{
return -1;
}
Compilation message (stderr)
# | 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... |