Submission #1042276

# Submission time Handle Problem Language Result Execution time Memory
1042276 2024-08-02T19:03:48 Z dpsaveslives Gondola (IOI14_gondola) C++17
25 / 100
23 ms 5200 KB
#include "gondola.h"
#include <bits/stdc++.h>
using namespace std;

int valid(int n, int inputSeq[]){
    int pos = -1; set<int> vals;
    for(int i = 0;i<n;++i){
        if(inputSeq[i] <= n && pos == -1){
            pos = i;
        }
        vals.insert(inputSeq[i]);
    }
    if(vals.size() != n){
        return 0;
    }
    if(pos == -1){
        return 1;
    }
    int cur = inputSeq[pos];
    for(int i = pos;i<n;++i){
        if(inputSeq[i] <= n){
            //cout << i << " " << cur << "\n";
            if(inputSeq[i] != cur){
                return 0;
            }
        }
        if(cur == n){
            cur = 0;
        }
        ++cur;
    }
    for(int i = 0;i<=pos-1;++i){
        if(inputSeq[i] <= n){
            if(inputSeq[i] != cur){
                return 0;
            }
        }
        if(cur == n){
            cur = 0;
        }
        ++cur;

    }
    return 1;
}
int replacement(int n, int gondolaSeq[], int replacementSeq[]){
    return 0;
}
int countReplacement(int n,	int	inputSeq[]){
    return 1;
}

Compilation message

gondola.cpp: In function 'int valid(int, int*)':
gondola.cpp:13:20: warning: comparison of integer expressions of different signedness: 'std::set<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   13 |     if(vals.size() != n){
      |        ~~~~~~~~~~~~^~~~
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 6 ms 2500 KB Output is correct
7 Correct 17 ms 4184 KB Output is correct
8 Correct 11 ms 4368 KB Output is correct
9 Correct 5 ms 1736 KB Output is correct
10 Correct 14 ms 4940 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 440 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 7 ms 2508 KB Output is correct
7 Correct 17 ms 4196 KB Output is correct
8 Correct 12 ms 4312 KB Output is correct
9 Correct 4 ms 1628 KB Output is correct
10 Correct 18 ms 5044 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 8 ms 2256 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 23 ms 5200 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Incorrect 0 ms 348 KB Output isn't correct
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Incorrect 0 ms 348 KB Output isn't correct
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Incorrect 0 ms 348 KB Output isn't correct
6 Halted 0 ms 0 KB -