Submission #107697

# Submission time Handle Problem Language Result Execution time Memory
107697 2019-04-25T13:35:38 Z FiloSanza Gondola (IOI14_gondola) C++14
0 / 100
3 ms 512 KB
#include <bits/stdc++.h>
#include "gondola.h"

using namespace std;

int valid(int N, int inputSeq[])
{
    vector<int> v, s;
    v.reserve(N);
    for(int i=0; i<N; i++) 
        if(inputSeq[i] <= N)
            v.push_back(inputSeq[i]);
        else
            s.push_back(inputSeq[i]);

    sort(s.begin(), s.end());
    for(int i=1; i<s.size(); i++) if(s[i-1] == s[i]) return 0;
    if(s.back() > N + s.size()) return 0;

    int mini = min_element(v.begin(), v.end()) - v.begin();

    map<int, int> cont;
    for(auto i : v) cont[i]++;

    for(auto i : cont) if(i.second > 1) return 0;

    for(int i=mini+1; i!=mini; i=(i+1)%v.size()){
        if(i == 0 && v.back() >= v.front()) return 0;
        if(v[i] <= v[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:17:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for(int i=1; i<s.size(); i++) if(s[i-1] == s[i]) return 0;
                  ~^~~~~~~~~
gondola.cpp:18:17: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     if(s.back() > N + s.size()) return 0;
        ~~~~~~~~~^~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Runtime error 3 ms 384 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 3 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 3 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 256 KB Integer -2 violates the range [0, 350000]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 376 KB Integer -2 violates the range [0, 350000]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 256 KB Integer -2 violates the range [0, 350000]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 284 KB Integer -3 violates the range [0, 1000000008]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 256 KB Integer -3 violates the range [0, 1000000008]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 256 KB Integer -3 violates the range [0, 1000000008]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 384 KB Integer -3 violates the range [0, 1000000008]
2 Halted 0 ms 0 KB -