이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "gondola.h"
#include <bits/stdc++.h>
#define pb push_back
#define all(x) x.begin(), x.end()
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<pii> vpi;
typedef vector<pll> vpl;
const int MAXN = 1e6 + 5;
vi input;
unordered_map<int, int> vis;
int valid(int N, int inputSeq[])
{
input.clear();
for(int i = 0; i < N; i++)
input.pb(inputSeq[i]);
int ans = 0, one = 0;
vis.clear();
for(int i = 0; i < N; i++)
{
if(vis[input[i]])
return 0;
vis[input[i]]++;
}
for(int i = 0; i < N; i++)
{
if(input[i] <= N)
{
one = 1;
int idx;
for(int j = 0; j < N; j++)
{
idx = (i + (j + 1 - input[i]) + N) % N;
if(input[idx] == j + 1 || input[idx] > N)
ans++;
}
cerr << i << " " << input[i] << " " << ans << "\n";
break;
}
}
if(!one)
return 1;
return (ans == N);
}
int replacement(int N, int gondolaSeq[], int replacementSeq[])
{
input.clear();
for(int i = 0; i < N; i++)
input.pb(gondolaSeq[i]);
int one = 0;
for(int i = 0; i < N; i++)
if(input[i] <= N)
one = (i - input[i] + 1 + N) % N;
vpi seq;
for(int i = 0; i < N; i++)
seq.pb({input[one + i], i + 1});
sort(all(seq));
int curr = 0, newGondola = N + 1;
for(int i = 0; i < N; i++)
{
while(seq[i].second != seq[i].first)
{
replacementSeq[curr++] = seq[i].second;
seq[i].second = newGondola++;
}
}
return curr;
}
int countReplacement(int N, int inputSeq[])
{
return 0;
}
# | 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... |