Submission #1297117

#TimeUsernameProblemLanguageResultExecution timeMemory
1297117harryleeeGondola (IOI14_gondola)C++20
Compilation error
0 ms0 KiB
#include "gondola.h"
#include <bits/stdc++.h>
using namespace std;
bool exist[25000];

int valid(int n, int a[]){
    memset(exist, false, sizeof(exist));
    int cnt = 0, pre = 0;
    for (int i = 0; i < n; ++i){
        if (exist[a[i]]) return false;
        exist[a[i]] = true;
    }
    for (int i = 0; i < n ++i){
        if (intputSeq[i] <= n && pre != 0){
            int x1 = inputSeq[pre], x2 = inputSeq[i];
            if (x1 > x2){
                if (pre + (n - x1) + x2 != i) return 0;
            }
            else if (x1 < x2){
                if (i - pre != x2 - x1) return 0;
            }
            pre = i;
        }
    }
    return true;
}

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

int countReplacement(int n, int inputSeq[]){
    return 0;
}

Compilation message (stderr)

gondola.cpp: In function 'int valid(int, int*)':
gondola.cpp:13:29: error: expected ';' before 'i'
   13 |     for (int i = 0; i < n ++i){
      |                             ^
      |                             ;
gondola.cpp:14:13: error: 'intputSeq' was not declared in this scope
   14 |         if (intputSeq[i] <= n && pre != 0){
      |             ^~~~~~~~~
gondola.cpp:15:22: error: 'inputSeq' was not declared in this scope
   15 |             int x1 = inputSeq[pre], x2 = inputSeq[i];
      |                      ^~~~~~~~
gondola.cpp:16:22: error: 'x2' was not declared in this scope; did you mean 'x1'?
   16 |             if (x1 > x2){
      |                      ^~
      |                      x1