답안 #402088

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
402088 2021-05-11T09:46:00 Z victoriad 곤돌라 (IOI14_gondola) C++14
10 / 100
12 ms 1120 KB
#include "gondola.h"
#include <cmath>
#include <cstdio>
#include <vector>
using namespace std;


int valid(int n,int inputSeq[]){
  bool p=true;
  int d=1e9,f=1e9;
  for(int i=0;i<n;i++){
    if(inputSeq[i]<=n){
      d=inputSeq[i]-i;
      f=n-inputSeq[i];
      break;
    }
  }
  if(d<1e9 && f<1e9){
  for(int i=0;i<=f;i++){
    if(inputSeq[i]<=n && inputSeq[i]!=i+d){
      p=false;
      break;
    }
  }
  if(p){
    for(int i=f+1;i<n;i++){
      if(inputSeq[i]<=n && inputSeq[i]!=i-f){
        p=false;
        break;
      }
    }
  }
  }
  if(p)return 1;
  return 0;
}

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

int replacement(int n, int gondolaSeq[], int replacementSeq[])
{ int x=0,y;
  for(int i=0;i<n;i++){
    if(gondolaSeq[i]<=n){
      x=gondolaSeq[i]-i;
      y=i+n-gondolaSeq[i];
    }
  }
  int l=0;
  for(int i=0;i<n;i++){
    if(gondolaSeq[i]>n){
      l++;
      if(i<=y){
        replacementSeq[gondolaSeq[i]-n-1]=i+x;
      }
      else{
        replacementSeq[gondolaSeq[i]-n-1]=i-y;
      }
    }
  }
  
  return l;
}
//----------------------

int countReplacement(int n, int inputSeq[])
{
  return -3;
}

Compilation message

gondola.cpp: In function 'int replacement(int, int*, int*)':
gondola.cpp:52:7: warning: 'y' may be used uninitialized in this function [-Wmaybe-uninitialized]
   52 |       if(i<=y){
      |       ^~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 6 ms 552 KB Output is correct
7 Correct 12 ms 1100 KB Output is correct
8 Correct 10 ms 900 KB Output is correct
9 Correct 4 ms 460 KB Output is correct
10 Correct 11 ms 1060 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 6 ms 588 KB Output is correct
7 Correct 12 ms 1120 KB Output is correct
8 Correct 12 ms 972 KB Output is correct
9 Correct 4 ms 460 KB Output is correct
10 Correct 11 ms 1056 KB Output is correct
11 Incorrect 1 ms 204 KB Output isn't correct
12 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 292 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Incorrect 1 ms 204 KB Integer -4 violates the range [1, 50]
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 280 KB Output is correct
5 Incorrect 1 ms 204 KB Integer -4 violates the range [1, 50]
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Incorrect 1 ms 204 KB Integer -4 violates the range [1, 50]
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 204 KB Integer -3 violates the range [0, 1000000008]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 204 KB Integer -3 violates the range [0, 1000000008]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 224 KB Integer -3 violates the range [0, 1000000008]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 284 KB Integer -3 violates the range [0, 1000000008]
2 Halted 0 ms 0 KB -