# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
341077 | mohamedsobhi777 | 곤돌라 (IOI14_gondola) | C++14 | 46 ms | 4716 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
#define f first
#define s second
#include "gondola.h"
int valid(int n, int inputSeq[])
{
map<int, int> mp;
for (int i = 0; i < n; ++i)
if (mp[inputSeq[i]]++)
return 0;
if (*min_element(inputSeq, inputSeq + n) > n)
return 1;
for (int i = 0; i < n; ++i)
inputSeq[i]--;
auto check = [&](int i) -> bool {
bool ret1 = 1;
for (int j = 1; j < n; ++j)
{
int nxt = (i + j) % n;
if (inputSeq[nxt] >= n)
continue;
if (inputSeq[nxt] != (inputSeq[i] + j) % n)
ret1 = 0;
}
return ret1;
};
for (int i = 0; i < n; ++i)
{
if (inputSeq[i] < n)
return check(i);
}
}
//----------------------
int replacement(int n, int gondolaSeq[], int replacementSeq[])
{
for (int i = 0; i < n; ++i)
gondolaSeq[i]--;
vector<int> a(n);
if (*min_element(gondolaSeq, gondolaSeq + n) >= n)
{
iota(a.begin(), a.end(), 0);
}
else
{
for (int i = 0; i < n; ++i)
{
if (gondolaSeq[i] < n)
{
for (int j = 0; j < n; ++j)
{
a[i] = (gondolaSeq[i] + j) % n;
}
break;
}
}
}
vector<pair<int, int>> v;
for (int i = 0; i < n; ++i)
{
v.push_back({a[i], i});
}
sort(v.begin(), v.end());
int l = 0;
int nxt = n;
for (int i = 0; i < n; ++i)
{
int j = v[i].s;
while (a[j] < gondolaSeq[j])
{
a[j] = nxt++;
replacementSeq[l++] = v[i].f + 1;
}
}
return l;
}
//----------------------
int countReplacement(int n, int inputSeq[])
{
return -3;
}
컴파일 시 표준 에러 (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... |