Submission #638376

#TimeUsernameProblemLanguageResultExecution timeMemory
638376ggohGondola (IOI14_gondola)C++14
Compilation error
0 ms0 KiB
#include<gondola.h> #include<bits/stdc++.h> using namespace std; typedef long long lint; int valid(int n, vector<int> inputSeq) { vector<int>check(n+1); for(int i=0;i<n;i++) { if(inputSeq[i]<=n)check[inputSeq[i]]=i+1; } int c=0,ans=1,t; for(int i=1;i<=n;i++) { if(check[i]) { if(!c)c=i,pos=check[i]; else { t=check[i]-pos; if(t<=0)t+=n; if(t!=i-c)ans=0; } } } return ans; }

Compilation message (stderr)

gondola.cpp: In function 'int valid(int, std::vector<int>)':
gondola.cpp:18:17: error: 'pos' was not declared in this scope; did you mean 'pow'?
   18 |       if(!c)c=i,pos=check[i];
      |                 ^~~
      |                 pow
gondola.cpp:21:20: error: 'pos' was not declared in this scope; did you mean 'pow'?
   21 |         t=check[i]-pos;
      |                    ^~~
      |                    pow