Submission #1026785

# Submission time Handle Problem Language Result Execution time Memory
1026785 2024-07-18T11:04:49 Z MarwenElarbi Gondola (IOI14_gondola) C++17
10 / 100
33 ms 6464 KB
#include <bits/stdc++.h>
#include "gondola.h"
using namespace std;
#define pb push_back
#define se second
#define fi first
const int nax=5e5+5;
const int MOD=1e9+7;
vector<pair<int,int>> tab;
int valid(int n, int inputSeq[])
{
    set<int> st;
    for (int i = 0; i < n; ++i)
    {
        st.insert(i+1);
    }
    bool test=true;
    bool nabba=false;
    for (int i = 0; i < n; ++i)
    {
        if(inputSeq[i]<=n){
            tab.pb({inputSeq[i],i});
            st.erase(inputSeq[i]);
        }
    }
    for (int i = 1; i < tab.size(); ++i)
    {
        if(tab[i].fi<tab[i-1].fi){
            if(nabba) test=false;
            nabba=true;
            if(tab[i].fi>tab[i].se-tab[i-1].se) test=false;
        }
    }
    for (int i = 0; i < n; ++i)
    {
        if(inputSeq[i]<=n){
            int cnt=inputSeq[i]-1;
            for (int j = i-1; j >= 0 && inputSeq[j]>n ; --j)
            {
                if(cnt==0) cnt=n;
                if(!st.count(cnt)){
                    test=false;
                }
                cnt--;
            }
        }
    }
    return test;
}

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

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:26:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   26 |     for (int i = 1; i < tab.size(); ++i)
      |                     ~~^~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 1 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 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 344 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 10 ms 2396 KB Output is correct
7 Correct 33 ms 6464 KB Output is correct
8 Correct 25 ms 4220 KB Output is correct
9 Correct 8 ms 1628 KB Output is correct
10 Correct 23 ms 5124 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 Correct 0 ms 444 KB Output is correct
6 Correct 10 ms 2396 KB Output is correct
7 Correct 33 ms 6336 KB Output is correct
8 Correct 19 ms 4268 KB Output is correct
9 Correct 5 ms 1628 KB Output is correct
10 Correct 22 ms 4996 KB Output is correct
11 Incorrect 0 ms 344 KB Output isn't correct
12 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 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 348 KB Integer -2 violates the range [0, 350000]
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 0 ms 348 KB Integer -3 violates the range [0, 1000000008]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 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 -