Submission #58773

# Submission time Handle Problem Language Result Execution time Memory
58773 2018-07-19T10:00:56 Z muradeyn Gondola (IOI14_gondola) C++14
20 / 100
55 ms 8392 KB
#include "gondola.h"
#include <bits/stdc++.h>

int valid(int n, int inputSeq[])
{
    std::set<int>st;
    int ls = -1,in;
    for (int i = 0;i<n;i++) {
        st.insert(inputSeq[i]);
        if (inputSeq[i] <= n) {
            if (ls == -1) {
                in = i;
                ls = inputSeq[i];
                continue;
            }
            if (inputSeq[i] < ls) {
                if (inputSeq[i] != 1)return 0;
                else if (ls - inputSeq[i] != n - i + in)return 0;
            }
            else {
                if (inputSeq[i] - ls != i - in)return 0;
            }
            in = i;
            ls = inputSeq[i];
        }
    }
    if (st.size() != n)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:27:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     if (st.size() != n)return 0;
         ~~~~~~~~~~^~~~
gondola.cpp:18:52: warning: 'in' may be used uninitialized in this function [-Wmaybe-uninitialized]
                 else if (ls - inputSeq[i] != n - i + in)return 0;
                                              ~~~~~~^~~~
# Verdict Execution time Memory Grader output
1 Correct 2 ms 248 KB Output is correct
2 Correct 3 ms 492 KB Output is correct
3 Correct 2 ms 492 KB Output is correct
4 Correct 2 ms 512 KB Output is correct
5 Correct 2 ms 668 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 692 KB Output is correct
2 Correct 2 ms 692 KB Output is correct
3 Correct 3 ms 692 KB Output is correct
4 Correct 3 ms 692 KB Output is correct
5 Correct 4 ms 692 KB Output is correct
6 Correct 24 ms 2700 KB Output is correct
7 Correct 22 ms 2700 KB Output is correct
8 Correct 31 ms 5340 KB Output is correct
9 Correct 15 ms 5340 KB Output is correct
10 Correct 55 ms 6644 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 6644 KB Output is correct
2 Correct 3 ms 6644 KB Output is correct
3 Correct 2 ms 6644 KB Output is correct
4 Correct 3 ms 6644 KB Output is correct
5 Correct 3 ms 6644 KB Output is correct
6 Correct 17 ms 6644 KB Output is correct
7 Correct 16 ms 6644 KB Output is correct
8 Correct 32 ms 7148 KB Output is correct
9 Correct 11 ms 7148 KB Output is correct
10 Correct 51 ms 8392 KB Output is correct
11 Correct 2 ms 8392 KB Output is correct
12 Correct 3 ms 8392 KB Output is correct
13 Correct 9 ms 8392 KB Output is correct
14 Correct 3 ms 8392 KB Output is correct
15 Correct 19 ms 8392 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 8392 KB Integer -2 violates the range [0, 350000]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 8392 KB Integer -2 violates the range [0, 350000]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 8392 KB Integer -2 violates the range [0, 350000]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 8392 KB Integer -3 violates the range [0, 1000000008]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 8392 KB Integer -3 violates the range [0, 1000000008]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 8392 KB Integer -3 violates the range [0, 1000000008]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 8392 KB Integer -3 violates the range [0, 1000000008]
2 Halted 0 ms 0 KB -