답안 #30940

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
30940 2017-08-02T00:32:15 Z kajebiii 곤돌라 (IOI14_gondola) C++14
20 / 100
19 ms 3388 KB
#include "gondola.h"
#include <bits/stdc++.h>

using namespace std;

#define SZ(v) ((int)(v).size())
#define ALL(v) (v).begin(),(v).end()
#define one first
#define two second
typedef long long ll;
typedef pair<double, double> pd;
typedef pair<int, int> pi; 
typedef pair<ll, int> pli;
typedef pair<ll, ll> pll; typedef pair<ll, pi> plp;
typedef tuple<int, int, int> ti; typedef tuple<ll, int, int> tli;
const int INF = 0x3f2f1f0f;
const ll LINF = 1ll * INF * INF * 2;

int valid(int n, int nr[]) {
    int ix = -1, cnt = 0;
    for(int i=0; i<n; i++) if(nr[i] >= 1 && nr[i] <= n) {
        ix = i;
        break;
    }
    if(ix == -1) {
        sort(nr, nr+n);
        for(int i=0; i+1<n; i++) if(nr[i] == nr[i+1]) return 0;
        return 1;
    }
    ix = (ix + n - (nr[ix]-1)) % n;
    for(int i=0; i<n; i++) if(nr[(ix+i)%n] != (i+1)) return 0;
    return 1;
}

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

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

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

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

Compilation message

gondola.cpp: In function 'int valid(int, int*)':
gondola.cpp:20:18: warning: unused variable 'cnt' [-Wunused-variable]
     int ix = -1, cnt = 0;
                  ^
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 3388 KB Output is correct
2 Correct 0 ms 3388 KB Output is correct
3 Correct 0 ms 3388 KB Output is correct
4 Correct 0 ms 3388 KB Output is correct
5 Correct 0 ms 3388 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 3388 KB Output is correct
2 Correct 0 ms 3388 KB Output is correct
3 Correct 0 ms 3388 KB Output is correct
4 Correct 0 ms 3388 KB Output is correct
5 Correct 0 ms 3388 KB Output is correct
6 Correct 3 ms 3388 KB Output is correct
7 Correct 13 ms 3388 KB Output is correct
8 Correct 9 ms 3388 KB Output is correct
9 Correct 3 ms 3388 KB Output is correct
10 Correct 16 ms 3388 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 3388 KB Output is correct
2 Correct 0 ms 3388 KB Output is correct
3 Correct 0 ms 3388 KB Output is correct
4 Correct 0 ms 3388 KB Output is correct
5 Correct 0 ms 3388 KB Output is correct
6 Correct 3 ms 3388 KB Output is correct
7 Correct 13 ms 3388 KB Output is correct
8 Correct 9 ms 3388 KB Output is correct
9 Correct 3 ms 3388 KB Output is correct
10 Correct 6 ms 3388 KB Output is correct
11 Correct 0 ms 3388 KB Output is correct
12 Correct 0 ms 3388 KB Output is correct
13 Correct 9 ms 3388 KB Output is correct
14 Correct 0 ms 3388 KB Output is correct
15 Correct 19 ms 3388 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 3388 KB Integer -2 violates the range [0, 350000]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 3388 KB Integer -2 violates the range [0, 350000]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 3388 KB Integer -2 violates the range [0, 350000]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 3388 KB Integer -3 violates the range [0, 1000000008]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 3388 KB Integer -3 violates the range [0, 1000000008]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 3388 KB Integer -3 violates the range [0, 1000000008]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 3388 KB Integer -3 violates the range [0, 1000000008]
2 Halted 0 ms 0 KB -