답안 #417812

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
417812 2021-06-04T10:47:33 Z arneves 곤돌라 (IOI14_gondola) C++17
20 / 100
13 ms 1896 KB
#include <bits/stdc++.h>
#include "gondola.h"

using namespace std;

typedef long long ll;

#define pb push_back
#define f first
#define s second
#define all(x) x.begin(), x.end()

const int MOD = 1'000'000'007;
const int MX = 100'005;
//long double PI = 3.14159265358979323846264338327950;

int valid(int n, int inputSeq[])
{
  //return -1;

    int a[250005];
    memset(a,-1,sizeof(a));

    for(int i=0; i<n; i++){

        if(a[inputSeq[i]-1]!=-1){
            return 0;
        }
        a[inputSeq[i]-1]=i;
    }

    int b[n];
    memset(b,-1,sizeof(b));

    for(int i=0; i<n; i++){
        if(a[i]!=-1){
            b[i]=a[i];

            for(int j=i+1; j<i+n; j++){
                b[j%n]=(b[(j-1)%n]+1)%n;
            }

            break;
        }
    }

    //for(int i=0; i<n; i++) cout<<b[i]<<' ';
    //cout<<'\n';
    for(int i=0; i<n; i++){
        if(a[i]!=-1&&b[i]!=-1){
            if(a[i]!=b[i]) return 0;
        }
    }

    return 1;
}

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

int replacement(int n, int gondolaSeq[], int replacementSeq[])
{
  return -2;
}

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

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

/*void caso_teste(){


}*/
/*
int main(){

    cin.tie(0);ios_base::sync_with_stdio(0);
    //freopen ("in.txt","r",stdin);

    int n_casos=1; //cin>>n_casos;

    //while(n_casos--) caso_teste();
    int a[4]={511, 511, 511, 511};
    cout<<valid(7, a);
}*/
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 1228 KB Output is correct
2 Correct 1 ms 1228 KB Output is correct
3 Correct 1 ms 1228 KB Output is correct
4 Correct 1 ms 1228 KB Output is correct
5 Correct 1 ms 1228 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 1228 KB Output is correct
2 Correct 1 ms 1228 KB Output is correct
3 Correct 1 ms 1228 KB Output is correct
4 Correct 1 ms 1228 KB Output is correct
5 Correct 1 ms 1228 KB Output is correct
6 Correct 6 ms 1484 KB Output is correct
7 Correct 10 ms 1612 KB Output is correct
8 Correct 10 ms 1740 KB Output is correct
9 Correct 4 ms 1356 KB Output is correct
10 Correct 12 ms 1896 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 1228 KB Output is correct
2 Correct 1 ms 1228 KB Output is correct
3 Correct 1 ms 1228 KB Output is correct
4 Correct 1 ms 1228 KB Output is correct
5 Correct 1 ms 1228 KB Output is correct
6 Correct 6 ms 1484 KB Output is correct
7 Correct 10 ms 1612 KB Output is correct
8 Correct 10 ms 1836 KB Output is correct
9 Correct 6 ms 1356 KB Output is correct
10 Correct 11 ms 1884 KB Output is correct
11 Correct 1 ms 1228 KB Output is correct
12 Correct 1 ms 1228 KB Output is correct
13 Correct 6 ms 1484 KB Output is correct
14 Correct 1 ms 1228 KB Output is correct
15 Correct 13 ms 1856 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 204 KB Integer -2 violates the range [0, 350000]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 204 KB Integer -2 violates the range [0, 350000]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 204 KB Integer -2 violates the range [0, 350000]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 204 KB Integer -3 violates the range [0, 1000000008]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 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 0 ms 204 KB Integer -3 violates the range [0, 1000000008]
2 Halted 0 ms 0 KB -