Submission #582222

#TimeUsernameProblemLanguageResultExecution timeMemory
582222jasminGondola (IOI14_gondola)C++17
Compilation error
0 ms0 KiB
#include<bits/stdc++.h> #include<gondola.h> using namespace std; #define int long long const int inf=1e18; vector<int> reorder(int n, vector<int> s){ int small=inf; int ind=-1; for(int i=0; i<n; i++){ if(s[i]<small){ small=s[i]; ind=i; } } if(n<small){ return s; } int start=(n+ind-(small-1))%n; vector<int> ans(n); for(int i=0; i<n; i++){ ans[i]=s[(start+i)%n]; } return ans; } bool valid(int n, signed s[]){ s=reorder(n, s); set<int> used; for(int i=0; i<n; i++){ if(s[i]!=i+1){ if(s[i]<=n || used.find(s[i])!=used.end()){ return false; } used.insert(s[i]); } } return true; } /*signed main(){ ios_base::sync_with_stdio(false); cin.tie(0); int n; cin >> n; vector<int> s(n); for(int i=0; i<n; i++){ cin >> s[i]; } cout << valid(n, s) << "\n"; }*/

Compilation message (stderr)

gondola.cpp: In function 'bool valid(long long int, int*)':
gondola.cpp:29:18: error: could not convert 's' from 'int*' to 'std::vector<long long int>'
   29 |     s=reorder(n, s);
      |                  ^
      |                  |
      |                  int*