Submission #103566

# Submission time Handle Problem Language Result Execution time Memory
103566 2019-03-31T14:08:49 Z SecretAgent007 Gondola (IOI14_gondola) C++17
10 / 100
24 ms 2064 KB
#include "gondola.h"
#include <bits/stdc++.h>

using namespace std;

int valid(int n, int inputSeq[]){

    int index = 0;
    int num = n;

    vector< bool > visited(n+1);

    for(int i = 0; i < n; i++){
        if(visited[inputSeq[i]]) return 0;
        visited[inputSeq[i]] = true;
        if(inputSeq[i] <= num){
            num = inputSeq[i];
            index = i;
        }
    }

    vector< int > check;
    vector< int > is;

    for(int i = index; i < n; i++){
        if(inputSeq[i] <= n){
            check.push_back(inputSeq[i]);
            is.push_back(inputSeq[i]);
        }
    }
    for(int i = 0; i < index; i++){
        if(inputSeq[i] <= n){
            check.push_back(inputSeq[i]);
            is.push_back(inputSeq[i]);
        }
    }
    sort(check.begin(), check.end());
    if(check == is) return 1;
    return 0;
}

int replacement(int n, int gondolaSeq[], int replacementSeq[]){

}


int countReplacement(int n, int inputSeq[]){

}
/*
int main(){
    int n;
    cin >> n;
    vector< int > v(n);
    for(int i = 0; i < n; i++){
        v[i] = i+1;
    }

    cout << valid(n,v) << endl;
}
*/

Compilation message

gondola.cpp: In function 'int replacement(int, int*, int*)':
gondola.cpp:44:1: warning: no return statement in function returning non-void [-Wreturn-type]
 }
 ^
gondola.cpp: In function 'int countReplacement(int, int*)':
gondola.cpp:49:1: warning: no return statement in function returning non-void [-Wreturn-type]
 }
 ^
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 2 ms 384 KB Output is correct
5 Correct 2 ms 256 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Correct 2 ms 256 KB Output is correct
4 Correct 2 ms 384 KB Output is correct
5 Correct 2 ms 384 KB Output is correct
6 Correct 11 ms 1192 KB Output is correct
7 Correct 24 ms 1144 KB Output is correct
8 Correct 12 ms 1832 KB Output is correct
9 Correct 6 ms 768 KB Output is correct
10 Correct 18 ms 2064 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 3 ms 256 KB Output is correct
4 Correct 2 ms 256 KB Output is correct
5 Correct 2 ms 384 KB Output is correct
6 Correct 8 ms 1192 KB Output is correct
7 Correct 13 ms 1152 KB Output is correct
8 Correct 21 ms 1832 KB Output is correct
9 Correct 5 ms 768 KB Output is correct
10 Correct 19 ms 1964 KB Output is correct
11 Correct 2 ms 256 KB Output is correct
12 Incorrect 3 ms 384 KB Output isn't correct
13 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 384 KB Integer 0 violates the range [1, 76]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 256 KB Integer 0 violates the range [1, 76]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 256 KB Integer 0 violates the range [1, 76]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 256 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -