답안 #759701

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
759701 2023-06-16T15:25:22 Z raysh07 곤돌라 (IOI14_gondola) C++17
20 / 100
25 ms 5660 KB
#include "gondola.h"
#include <bits/stdc++.h>
using namespace std;

int valid(int n, int a[])
{
    set <int> st;
    for (int i = 0; i < n; i++) st.insert(a[i]);
    
    if (st.size() != n) return 0;
    
    vector <int> b;
    for (int i = 0; i < n; i++){
        if (a[i] <= n) b.push_back(a[i]);
    }
    
    for (int i = 1; i < b.size(); i++){
        int need = b[i - 1] + 1;
        if (need > n) need = 1;
        
        if (b[i] != need) 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:10:19: warning: comparison of integer expressions of different signedness: 'std::set<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   10 |     if (st.size() != n) return 0;
      |         ~~~~~~~~~~^~~~
gondola.cpp:17:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   17 |     for (int i = 1; i < b.size(); i++){
      |                     ~~^~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 304 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 8 ms 2772 KB Output is correct
7 Correct 21 ms 4052 KB Output is correct
8 Correct 15 ms 4972 KB Output is correct
9 Correct 6 ms 1784 KB Output is correct
10 Correct 19 ms 5660 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 340 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 8 ms 2772 KB Output is correct
7 Correct 20 ms 4092 KB Output is correct
8 Correct 15 ms 4944 KB Output is correct
9 Correct 5 ms 1748 KB Output is correct
10 Correct 23 ms 5640 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Correct 0 ms 308 KB Output is correct
13 Correct 10 ms 2260 KB Output is correct
14 Correct 1 ms 308 KB Output is correct
15 Correct 25 ms 5568 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 304 KB Integer -2 violates the range [0, 350000]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 308 KB Integer -2 violates the range [0, 350000]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 212 KB Integer -2 violates the range [0, 350000]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 212 KB Integer -3 violates the range [0, 1000000008]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 212 KB Integer -3 violates the range [0, 1000000008]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 304 KB Integer -3 violates the range [0, 1000000008]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 212 KB Integer -3 violates the range [0, 1000000008]
2 Halted 0 ms 0 KB -