# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
528864 | Alex_tz307 | Gondola (IOI14_gondola) | C++17 | 7 ms | 588 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<bits/stdc++.h>
#include "gondola.h"
using namespace std;
int valid(int n, int a[]) {
int pos = 0;
for (int i = 0; i < n; ++i) {
if (a[i] == 1) {
pos = i;
break;
}
}
for (int x = 1; x <= n; ++x) {
if (a[pos] != x) {
return 0;
}
pos += 1;
if (pos == n) {
pos = 0;
}
}
return 1;
}
int replacement(int n, int a[], int sol[]) {
vector<int> v(n);
iota(v.begin(), v.end(), 1);
for (int i = 0; i < n; ++i) {
if (a[i] == 1) {
for (int x = 1; x <= n; ++x) {
a[i] = x;
i += 1;
if (i == n) {
i = 0;
}
}
break;
}
}
vector<pair<int, int>> w(n);
for (int i = 0; i < n; ++i) {
w[i] = make_pair(a[i], v[i]);
}
sort(w.begin(), w.end());
int len = 0, x = n + 1;
for (int i = 0; i < n; ++i) {
while (w[i].second < w[i].first) {
sol[len++] = w[i].second;
w[i].second = x;
x += 1;
}
}
return len;
}
int countReplacement(int n, int gondolaSeq[]){
}
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... |