제출 #582224

#제출 시각아이디문제언어결과실행 시간메모리
582224jasmin곤돌라 (IOI14_gondola)C++17
컴파일 에러
0 ms0 KiB
#include<bits/stdc++.h> #include<gondola.h> using namespace std; const int inf=1e9; 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, int 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"; }*/

컴파일 시 표준 에러 (stderr) 메시지

gondola.cpp:27:6: error: ambiguating new declaration of 'bool valid(int, int*)'
   27 | bool valid(int n, int s[]){
      |      ^~~~~
In file included from gondola.cpp:2:
gondola.h:8:5: note: old declaration 'int valid(int, int*)'
    8 | int valid(int n, int inputSeq[]);
      |     ^~~~~
gondola.cpp: In function 'bool valid(int, int*)':
gondola.cpp:28:18: error: could not convert 's' from 'int*' to 'std::vector<int>'
   28 |     s=reorder(n, s);
      |                  ^
      |                  |
      |                  int*