Submission #1017289

# Submission time Handle Problem Language Result Execution time Memory
1017289 2024-07-09T07:14:11 Z simona1230 Gondola (IOI14_gondola) C++17
0 / 100
1 ms 348 KB
#include "gondola.h"
#include <bits/stdc++.h>
using namespace std;
int n;
int a[100001];
map<int,int> mp;
bool check()
{
    mp.clear();
    int idx=-1;
    for(int i=0;i<n;i++)
    {
        if(mp[a[i]])return 0;
        mp[a[i]]++;
        if(a[i]<=n)
        {
            idx=i;
        }
    }
    if(idx==-1)return 1;

    int curr=a[idx];
    for(int i=idx;i<n;i++)
    {
        if(a[i]<=n&&a[i]!=curr)return 0;
        curr++;
    }

    for(int i=0;i<idx;i++)
    {
        if(a[i]<=n&&a[i]!=curr)return 0;
        curr++;
    }
}

int valid(int N, int inputSeq[])
{
    n=N;
    for(int i=0;i<n;i++)
        a[i]=inputSeq[i];
    return check();
}

//----------------------

int replacement(int N, int gondolaSeq[], int replacementSeq[])
{
    n=N;
    return -2;
}

//----------------------

int countReplacement(int N, int inputSeq[])
{
    n=N;
    return -3;
}

Compilation message

gondola.cpp: In function 'bool check()':
gondola.cpp:34:1: warning: control reaches end of non-void function [-Wreturn-type]
   34 | }
      | ^
# 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 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 344 KB Integer -2 violates the range [0, 350000]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB Integer -2 violates the range [0, 350000]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Integer -2 violates the range [0, 350000]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB Integer -3 violates the range [0, 1000000008]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB Integer -3 violates the range [0, 1000000008]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 348 KB Integer -3 violates the range [0, 1000000008]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 348 KB Integer -3 violates the range [0, 1000000008]
2 Halted 0 ms 0 KB -