이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "gondola.h"
#include <bits/stdc++.h>
#define jizz ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define pb push_back
#define MP make_pair
#define F first
#define S second
#define MEM(i,j) memset(i,j,sizeof i)
#define ALL(v) v.begin(),v.end()
#define ET cout << "\n"
#define DB(a,s,e) {for(int i=s;i<e;++i) cout << a[i] << " ";ET;}
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
int valid(int n, int inputSeq[])
{
int p=min_element(inputSeq,inputSeq+n)-inputSeq;
vector<int> v(inputSeq,inputSeq+n);
sort(ALL(v));
for(int i=0;i+1<n;++i)
if(v[i]==v[i+1]) return 0;
if(inputSeq[p]>n) return 1;
for(int i=p;i<p+n;++i)
if(inputSeq[i%n]<=n&&inputSeq[i%n]!=inputSeq[p]+i-p)
return 0;
return 1;
}
//----------------------
int replacement(int n, int gondolaSeq[], int replacementSeq[])
{
vector<int> org(n);
int p=min_element(gondolaSeq,gondolaSeq+n)-gondolaSeq;
if(gondolaSeq[p]>n)
for(int i=0;i<n;++i)
org[i]=i+1;
else
for(int i=p;i<p+n;++i)
org[i%n]=(gondolaSeq[p]+i-p-1)%n+1;
vector<pii> v;
for(int i=0;i<n;++i)
if(gondolaSeq[i]>n)
v.pb(MP(gondolaSeq[i],i));
sort(ALL(v));
int nw=n+1,tp=0;
for(pii i:v)
{
replacementSeq[tp++]=org[i.S];
while(nw<=i.F)
replacementSeq[tp++]=nw++;
}
return nw-n-1;
}
//----------------------
int countReplacement(int n, int inputSeq[])
{
if(!valid(n,inputSeq)) return 0;
}
컴파일 시 표준 에러 (stderr) 메시지
gondola.cpp: In function 'int countReplacement(int, int*)':
gondola.cpp:64:1: warning: control reaches end of non-void function [-Wreturn-type]
}
^
# | 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... |