답안 #70288

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
70288 2018-08-22T14:45:59 Z alenam0161 곤돌라 (IOI14_gondola) C++17
10 / 100
21 ms 876 KB
#include "gondola.h"
#include <bits/stdc++.h>
using namespace std;
int pos(int n,int rng[]){
    return min_element(rng,rng+n)-rng;
}
int valid(int n, int inputSeq[])
{
  int mn=pos(n,inputSeq);
  int mx=inputSeq[mn];
  if(inputSeq[mn]>n)return 1;
  for(int j=1;j<n;++j){
      mn++;
      if(mn==n)mn=0;
      if(inputSeq[mn]<=n&&inputSeq[mn]<mx){
          return 0;
      }
      if(inputSeq[mn]<=n)mx=max(mx,inputSeq[mn]);
  }
  return 1;
}

//----------------------

int replacement(int n, int gondolaSeq[], int replacementSeq[])
{

  vector<pair<int,int>> vx;
  int p=pos(n,gondolaSeq);
  for(int i=0;i<n;++i){
     if(gondolaSeq[i]>n){
        vx.push_back({gondolaSeq[i],i<p ? n-p+i:i-p});
     }
  }
  sort(vx.begin(),vx.end());
  int sz=0;
  for(auto to:vx){
    int x=to.first;
    int st=to.second+1;
    if(st!=x){
        replacementSeq[sz++]=st;
    }
    while(true){
        n++;
        st=n;
        if(st<x)
        replacementSeq[sz++]=n;
        else break;
    }
  //  cout<<x<< " "<<st<<endl;
  }
  return sz;
}

//----------------------

int countReplacement(int n, int inputSeq[])
{
    return 5;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 380 KB Output is correct
2 Correct 2 ms 380 KB Output is correct
3 Correct 3 ms 428 KB Output is correct
4 Correct 2 ms 488 KB Output is correct
5 Correct 4 ms 488 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 488 KB Output is correct
2 Correct 3 ms 564 KB Output is correct
3 Correct 3 ms 564 KB Output is correct
4 Correct 2 ms 564 KB Output is correct
5 Correct 2 ms 620 KB Output is correct
6 Correct 8 ms 748 KB Output is correct
7 Correct 15 ms 876 KB Output is correct
8 Correct 13 ms 876 KB Output is correct
9 Correct 5 ms 876 KB Output is correct
10 Correct 15 ms 876 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 876 KB Output is correct
2 Correct 3 ms 876 KB Output is correct
3 Correct 2 ms 876 KB Output is correct
4 Correct 2 ms 876 KB Output is correct
5 Correct 3 ms 876 KB Output is correct
6 Correct 5 ms 876 KB Output is correct
7 Correct 21 ms 876 KB Output is correct
8 Correct 16 ms 876 KB Output is correct
9 Correct 5 ms 876 KB Output is correct
10 Correct 20 ms 876 KB Output is correct
11 Incorrect 2 ms 876 KB Output isn't correct
12 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 876 KB Output is correct
2 Incorrect 3 ms 876 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 876 KB Output is correct
2 Incorrect 3 ms 876 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 876 KB Output is correct
2 Incorrect 3 ms 876 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 3 ms 876 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 3 ms 876 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 876 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 876 KB Output isn't correct
2 Halted 0 ms 0 KB -