# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
374456 | Aryan_Raina | Gondola (IOI14_gondola) | C++14 | 40 ms | 4612 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;
int valid(int n, int a[]) {
int rr = -1;
set<int> vis;
for (int i = 0; i < n; i++) {
if (vis.count(a[i])) return 0;
vis.insert(a[i]);
if (a[i] <= n) {
if (rr == -1) rr = i;
if ((n + a[i] - a[rr]) % n != (n + i - rr) % n) return 0;
}
}
return 1;
}
//----------------------
int replacement(int n, int a[], int replacementSeq[]) {
int rr = -1;
for (int i = 0; i < n; i++) {
if (a[i] <= n) {
rr = i; break;
}
}
vector<array<int,2>> rep;
for (int i = 0; i < n; i++) {
if (a[i] > n) {
int x = (a[rr] + i - rr + n) % n;
if (x == 0) x = n;
rep.push_back({a[i], x});
}
}
sort(rep.begin(), rep.end());
int ind = 0, last = n+1;
for (int i = 0; i < rep.size(); ++i) {
replacementSeq[ind++] = rep[i][1];
last++;
for (; last <= rep[i][0]; ++last) replacementSeq[ind++] = last-1;
}
return ind;
}
//----------------------
int countReplacement(int n, int inputSeq[]) {
return -3;
}
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... |