| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 259933 | srj | 곤돌라 (IOI14_gondola) | C++14 | 96 ms | 9976 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "gondola.h"
#include<bits/stdc++.h>
using namespace std;
int valid(int n, int inputSeq[])
{
map<int,int> pos;
for(int i =0;i<n;i++){
if(pos.find(inputSeq[i])!=pos.end())
return 0;
pos[inputSeq[i]] = i;
}
int sortSeq[n];
memcpy(sortSeq,inputSeq,sizeof(sortSeq));
sort(sortSeq,sortSeq+n);
if(sortSeq[0]>n)
return 1;
int smallval = sortSeq[0];
int cur = pos[sortSeq[0]];
for(int i =0;i<n;i++){
if(inputSeq[(cur+i)%n]!=smallval+i && inputSeq[(cur+i)%n]<=n){
// cout << smallval << endl;
// cout << i << endl;
return 0;
}
}
return 1;
}
//----------------------
int replacement(int n, int gondolaSeq[], int replacementSeq[])
{
map<int,int> pos;
for(int i =0;i<n;i++){
if(pos.find(gondolaSeq[i])!=pos.end())
return 0;
pos[gondolaSeq[i]] = i;
}
int sortSeq[n];
map<int,int> what;
memcpy(sortSeq,gondolaSeq,sizeof(sortSeq));
sort(sortSeq,sortSeq+n);
int pos1 = 0;
if(sortSeq[0]<=n){
pos1 = (n+pos[sortSeq[0]]-sortSeq[0]+1)%n;
}
what[pos1] = 1;
pos[1] = pos1;
for(int i =2;i<=n;i++){
pos[i] = (n+pos1+i-1)%n;
what[pos[i]] = i;
}
int nxt = n+1;
int ans = sortSeq[n-1] - nxt+1;
int j =0;
for(int i =0;i<n;i++){
if(sortSeq[i]>n){
int where = pos[sortSeq[i]];
int prev = what[where];
while(prev!=sortSeq[i]){
replacementSeq[j] = prev;
prev=nxt;
nxt++;
j++;
}
what[where] = prev;
}
}
return ans;
}
//----------------------
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... | ||||
