# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
783218 | zsombor | 곤돌라 (IOI14_gondola) | C++17 | 59 ms | 5896 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 <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include "gondola.h"
using namespace std;
using ll = long long;
ll MOD = 1e9 + 9;
int valid(int n, int g[]) {
set <int> s;
for (int i = 0; i < n; i++) {
if (s.count(g[i])) return 0;
s.insert(g[i]);
}
int p = 0;
for (int i = 0; i < n; i++) if (g[i] <= n) p = (g[i] - i + n) % n;
for (int i = 0; i < n; i++) if (g[i] <= n && (g[i] - i + n) % n != p) return 0;
return 1;
}
int replacement(int n, int g[], int r[]) {
int p = 0, cnt = 0, mx = 0;
vector <int> rev(1e6 + 1, -1);
vector <int> cur(n, 0);
for (int i = 0; i < n; i++) {
if (g[i] <= n) { p = (g[i] - i + n) % n; cnt++; }
mx = max(mx, g[i]);
rev[g[i]] = i;
# | 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... |