Submission #212648

#TimeUsernameProblemLanguageResultExecution timeMemory
212648mohamedsobhi777곤돌라 (IOI14_gondola)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #include "gondola.h" using namespace std ; const int N = 3e5 + 7 ; int valid(int n, int inputSeq[]){ vector<int> vis(N , 0) ; int cur = inputSeq[0] -1 ; for(int i = 0 ; i < n; i++){ if(vis[inputSeq[i]]++)return 0 ; if(--inputSeq[i]!=cur) return 0 ; cur = (cur+1) %n ; } return 1 ; int ab[N] ; int replacement(int n, int gondolaSeq[], int replacementSeq[]) { priority_queue<int> q ; int mx = 0 ; for(int i = 0 ; i< n;i ++){ q.push(gondolaSeq[i] ) ; ab[gondolaSeq[i]] = -1 ; mx = max(mx , gondolaSeq[i]) ; } int cur = 0 ; int cabs = mx ; while(q.size()){ int tp = q.top() ; if(tp==n)break; while(ab[cabs]==-1){ cabs--; } replacementSeq[cur++] = cabs ; q.pop() ; q.push(cabs) ; cabs-- ; } reverse(replacementSeq , replacementSeq + cur) ; return cur ; } int countReplacement(int n, int inputSeq[]) { return -3; }

Compilation message (stderr)

gondola.cpp: In function 'int valid(int, int*)':
gondola.cpp:21:1: error: a function-definition is not allowed here before '{' token
 {
 ^
gondola.cpp:46:1: error: a function-definition is not allowed here before '{' token
 {
 ^
gondola.cpp:19:5: warning: unused variable 'ab' [-Wunused-variable]
 int ab[N] ; 
     ^~
gondola.cpp:48:1: error: expected '}' at end of input
 }
 ^