# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1065664 | andrei_iorgulescu | 곤돌라 (IOI14_gondola) | C++14 | 25 ms | 10840 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#include "gondola.h"
#warning That's not FB, that's my FB
using namespace std;
int valid(int n, int inputSeq[])
{
for (int i = 0; i < n; i++)
inputSeq[i]--;
int shift = -1;
set<int> ele;
for (int i = 0; i < n; i++)
ele.insert(inputSeq[i]);
if (ele.size() != n)
return 0;
for (int i = 0; i < n; i++)
{
if (inputSeq[i] < n)
{
int cur_shift = (n + inputSeq[i] - i) % n;
if (shift == -1)
shift = cur_shift;
else if (shift != cur_shift)
return 0;
}
}
return 1;
}
int replacement(int n, int gondolaSequence[], int replacementSeq[])
{
for (int i = 0; i < n; i++)
gondolaSequence[i]--;
int mxe = 0;
for (int i = 0; i < n; i++)
mxe = max(mxe, gondolaSequence[i]);
vector<int> pos(mxe + 5), ans(mxe + 5);
for (int i = 0; i <= mxe; i++)
pos[i] = -1;
for (int i = 0; i < n; i++)
pos[gondolaSequence[i]] = i;
set<int> spatii;
for (int i = mxe; i >= 0; i--)
{
if (pos[i] == -1)
ans[i] = *spatii.begin();
else
ans[i] = pos[i], spatii.insert(pos[i]);
}
int shift = 0;
for (int i = 0; i < n; i++)
{
if (gondolaSequence[i] < n)
{
shift = (n + gondolaSequence[i] - i) % n;
}
}
vector<vector<int>> lol(n);
for (int i = 0; i < n; i++)
lol[i].push_back((i + shift) % n);
for (int i = n; i <= mxe; i++)
lol[ans[i]].push_back(i);
vector<int> cur(n);
for (int i = n; i <= mxe; i++)
{
replacementSeq[i - n] = lol[ans[i]][cur[ans[i]]];
cur[ans[i]]++;
}
for (int i = 0; i <= mxe - n; i++)
replacementSeq[i]++;
return mxe - n + 1;
}
int countReplacement(int n, int inputSeq[])
{
return -1;
}
컴파일 시 표준 에러 (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... |