이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "gondola.h"
#include <bits/stdc++.h>
using namespace std;
//valid
vector<pair<int,int>> input;//(val,id)
vector<pair<int,int>> rep;//(val,id)
int valid(int n, int inputSeq[])
{
for(int i=0;i<n;i++){
input.push_back({inputSeq[i],i});
}
sort(input.begin(),input.end());
int prev=-1;
for(int i=0;i<n;i++){
if(input[i].first==prev) return 0;
prev=input[i].first;
}
int prev_pos=-1;
for(int i=0;i<n&&input[i].first<=n;i++){
if((i!=0)&&((input[i].first-prev)!=((input[i].second-prev_pos+n)%n))){
return 0;
}
prev=input[i].first;
prev_pos=input[i].second;
}
return 1;
}
//----------------------
int mod1(int x,int m){
x%=m;
if(x==0) x=m;
return x;
}
int replacement(int n, int gondolaSeq[], int replacementSeq[])
{
int extra=0;
for(int i=0;i<n;i++){
if(gondolaSeq[i]>n) rep.push_back({gondolaSeq[i],i});
else extra=(gondolaSeq[i]-i+n)%n;
}
for(auto& p:rep){
p.second+=extra;
p.second=mod1(p.second,n);
}
sort(rep.begin(),rep.end());
int l=0;
int prev=n;
for(auto p:rep){
replacementSeq[l]=p.second;
l++;
for(int i=prev+1;i<p.first;i++){
replacementSeq[l]=i;
l++;
}
prev=p.first;
}
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... |