이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "gondola.h"
#include <bits/stdc++.h>
#define fi first
#define se second
#define eb emplace_back
#define em emplace
#define all(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
const int MAX = 101010;
const int INF = INT_MAX >> 1;
const ll LINF = LLONG_MAX >> 1;
int valid(int n, int arr[]) {
vector <bool> chk(250050);
int idx = -1;
for(int i = 0; i < n; i++) {
if(arr[i] <= n && idx == -1) {
idx = i;
}
else if(arr[i] <= n) {
int temp = arr[idx] + i - idx;
temp %= n;
if(temp == 0) temp = n;
if(temp != arr[i]) return 0;
}
}
sort(arr, arr+n);
for(int i = 1; i < n; i++) {
if(arr[i] == arr[i-1]) return 0;
}
return 1;
}
int replacement(int n, int gondolaSeq[], int replacementSeq[]) {
int l = 0;
vector <int> ori(n, -1);
for(int i = 0; i < n; i++) {
l = max(gondolaSeq[i] - n, l);
if(gondolaSeq[i] <= n && ori[0] == -1) {
ori[i] = gondolaSeq[i];
for(int j = 1; j < n; j++) {
ori[(i+j)%n] = (ori[i] + j) % n;
if(ori[(i+j)%n] == 0) ori[(i+j)%n] = n;
}
}
}
vector <pii> temp;
for(int i = 0; i < n; i++) {
temp.eb(gondolaSeq[i], i);
}
sort(all(temp));
int idx = 0, last = n + 1;
for(int i = 0; i < n; i++) {
if(temp[i].fi > n) {
replacementSeq[idx++] = ori[temp[i].se];
while(last < temp[i].fi) {
replacementSeq[idx++] = last++;
}
last++;
}
}
return l;
}
int countReplacement(int n, int inputSeq[]) {
return -3;
}
# | 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... |