Submission #50728

# Submission time Handle Problem Language Result Execution time Memory
50728 2018-06-13T05:49:23 Z Talant Gondola (IOI14_gondola) C++17
25 / 100
17 ms 920 KB
#include "gondola.h"

#include <bits/stdc++.h>

using namespace std;

const int N = 2e6 + 5;

int u[N],mx;
int id;
int mn = 1e9 + 7;

vector <int> v;

int valid(int n, int inputSeq[])
{
      for (int i = 0; i < n; i ++) {
            if (inputSeq[i] < mn)
                  mn = inputSeq[i],id = i;
            mx = max(mx,inputSeq[i]);
      }
      if (mx > n)
            return 0;
      int o = mn;
      for (int i = id - 1; i >= 0; i --) {
            mn --;
            if (mn == 0) mn = n;
            if (inputSeq[i] > n)
                  continue;
            if (mn != inputSeq[i])
                  return 0;
      }
      mn = o;
      for (int i = id + 1; i < n; i ++) {
            mn ++;
            if (mn == n + 1) mn = 1;
            if (inputSeq[i] > n)
                  continue;
            if (mn != inputSeq[i])
                  return 0;
      }
      return 1;
}

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

int replacement(int n, int gondolaSeq[], int replacementSeq[])
{
      for (int i = 0; i < n; i ++) {
            mx = max(mx,gondolaSeq[i]);
            u[gondolaSeq[i]] = 1;
      }
      for (int i = 1; i <= mx; i ++) {
            if (!u[i])
                  replacementSeq[id ++] = i;
      }
      return id;
}

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

int countReplacement(int n, int inputSeq[])
{
  return -3;
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 3 ms 564 KB Output is correct
4 Correct 2 ms 564 KB Output is correct
5 Correct 2 ms 564 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 564 KB Output is correct
2 Correct 2 ms 564 KB Output is correct
3 Correct 2 ms 564 KB Output is correct
4 Correct 2 ms 564 KB Output is correct
5 Correct 2 ms 564 KB Output is correct
6 Correct 7 ms 664 KB Output is correct
7 Correct 15 ms 792 KB Output is correct
8 Correct 14 ms 792 KB Output is correct
9 Correct 7 ms 792 KB Output is correct
10 Correct 14 ms 844 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 844 KB Output is correct
2 Correct 2 ms 844 KB Output is correct
3 Correct 2 ms 844 KB Output is correct
4 Correct 3 ms 844 KB Output is correct
5 Correct 2 ms 844 KB Output is correct
6 Correct 7 ms 844 KB Output is correct
7 Correct 15 ms 876 KB Output is correct
8 Correct 12 ms 920 KB Output is correct
9 Correct 6 ms 920 KB Output is correct
10 Correct 14 ms 920 KB Output is correct
11 Correct 2 ms 920 KB Output is correct
12 Correct 2 ms 920 KB Output is correct
13 Correct 8 ms 920 KB Output is correct
14 Correct 2 ms 920 KB Output is correct
15 Correct 17 ms 920 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 920 KB Output is correct
2 Correct 2 ms 920 KB Output is correct
3 Correct 2 ms 920 KB Output is correct
4 Correct 3 ms 920 KB Output is correct
5 Correct 2 ms 920 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 920 KB Output is correct
2 Correct 2 ms 920 KB Output is correct
3 Correct 2 ms 920 KB Output is correct
4 Correct 2 ms 920 KB Output is correct
5 Correct 2 ms 920 KB Output is correct
6 Correct 2 ms 920 KB Output is correct
7 Incorrect 2 ms 920 KB Output isn't correct
8 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 920 KB Output is correct
2 Correct 2 ms 920 KB Output is correct
3 Correct 3 ms 920 KB Output is correct
4 Correct 2 ms 920 KB Output is correct
5 Correct 3 ms 920 KB Output is correct
6 Correct 2 ms 920 KB Output is correct
7 Incorrect 3 ms 920 KB Output isn't correct
8 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 920 KB Integer -3 violates the range [0, 1000000008]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 920 KB Integer -3 violates the range [0, 1000000008]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 920 KB Integer -3 violates the range [0, 1000000008]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 920 KB Integer -3 violates the range [0, 1000000008]
2 Halted 0 ms 0 KB -