# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
489290 | QuantumK9 | 곤돌라 (IOI14_gondola) | C++17 | 30 ms | 4528 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "gondola.h"
#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define mp make_pair
using namespace std;
int valid(int n, int inputSeq[]){
ll mx = n;
set<ll> memo;
ll i = 0;
ll expectedVal;
while ( i < n ){
ll use = inputSeq[i];
i++;
if ( memo.find(use) != memo.end() ){ return 0; }
memo.insert( use );
mx = max( mx, use );
if ( use <= n ){ expectedVal = use; break; }
}
for ( ; i < n; i++ ){
expectedVal++; if( expectedVal > n ){ expectedVal -= n; }
//cout << inputSeq[i] << " " << expectedVal << endl;
ll use = inputSeq[i];
if ( use <= n ){
if ( use != expectedVal ){ return 0; }
}
if ( memo.find(use) != memo.end() ){ return 0; }
memo.insert( use );
mx = max( mx, use );
}
//for( ll j = n+1; j <= mx; j++ ){ if ( memo.find(j) == memo.end() ){ return 0; } }
return 1;
}
//----------------------
int replacement(int n, int gondolaSeq[], int replacementSeq[]){
vector< pair<ll, ll> > makeAyos; // newVal, expectedVal
ll i = 0;
ll expectedVal = -1;
while ( i < n ){
ll u = gondolaSeq[i];
if ( u <= n ){ expectedVal = u; break; }
i++;
}
// case 1 -- > at least one default value remains
if ( expectedVal != -1 ){
expectedVal -= i;
if ( expectedVal <= 0 ){ expectedVal += n; }
}
// case 2 -- > no more default values remain
else{
expectedVal = 1;
}
//cout << "ev: " << expectedVal << endl;
for( int j = 0; j < n; j++ ){
if ( gondolaSeq[j] != expectedVal ){
makeAyos.pb ( mp( gondolaSeq[j], expectedVal ) );
}
expectedVal++; if ( expectedVal > n ){ expectedVal -= n; }
}
sort( makeAyos.begin(), makeAyos.end());
// for( int l = 0; l < makeAyos.size(); l++ ){
// cout << makeAyos[l].first << " " << makeAyos[l].second << endl;
// }
ll cnt = 0;
ll replacementVal = n+1;
for( int k = 0; k < makeAyos.size(); k++ ){
// at least one do-up
replacementSeq[ cnt ] = makeAyos[k].second;
cnt++;
replacementVal++;
while ( replacementVal <= makeAyos[k].first ){
replacementSeq[ cnt ] = replacementVal-1;
cnt++;
replacementVal++;
}
}
return cnt;
}
//----------------------
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... |