Submission #105084

# Submission time Handle Problem Language Result Execution time Memory
105084 2019-04-10T13:52:52 Z WLZ Gondola (IOI14_gondola) C++17
0 / 100
3 ms 384 KB
#include "gondola.h"
#include <bits/stdc++.h>
using namespace std;

int valid(int n, int inputSeq[]) {
  int pos = -1;
  set<int> used;
  for (int i = 0; i < n; i++) {
    if (used.count(inputSeq[i])) {
      return 0;
    }
    used.insert(inputSeq[i]);
    if (inputSeq[i] <= n) {
      pos = i;
    }
  }
  if (pos == -1) {
    return 1;
  }
  int cur = inputSeq[pos] - pos;
  if (cur < 1) {
    cur = n - cur;
  }
  for (int i = 0; i < n; i++) {
    if (inputSeq[i] <= n && inputSeq[i] != cur) {
      return 0;
    }
    cur++;
    if (cur > n) {
      cur = 1;
    }
  }
  return 1;
}

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

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

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

int countReplacement(int n, int inputSeq[]) {
  return -3;
}
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 384 KB Integer -2 violates the range [0, 350000]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 384 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 256 KB Integer -3 violates the range [0, 1000000008]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 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 304 KB Integer -3 violates the range [0, 1000000008]
2 Halted 0 ms 0 KB -