Submission #57703

#TimeUsernameProblemLanguageResultExecution timeMemory
57703FLDutchman곤돌라 (IOI14_gondola)C++14
Compilation error
0 ms0 KiB
//#include "gondola.h" #include <bits/stdc++.h> using namespace std; typedef int INT; #define mp make_pair #define pb push_back #define fst first #define snd second #define int long long #define MMAX 16384 #define fast_io() ios::sync_with_stdio(false) #define FOR(i, l, r) for(int i = (l); i < (r); i++) typedef long long ll; typedef pair<ll, ll> ii; typedef vector<int> vi; typedef vector<ii> vii; typedef vector<vi> vvi; typedef set<int> si; typedef double ld; typedef pair<ld, ld> dd; const ll INF = 1000000000000000000LL; const int NMAX = 1e5+4; const int mod = 1e9+7; const ld eps = 1e-10; const ld PI = acos(-1); INT valid(INT n, INT inputSeq[]){ int k = -1; FOR(i, 0, n) if(inputSeq[i] <= n) {k = i; break;} if(k == -1) { vi tmp; FOR(i, 0, n) tmp.pb(inputSeq[i]); sort(tmp.begin(), tmp.end()); FOR(i, 0, n-1) if(tmp[i] == tmp[i+1]) return false; return true; } int pos = (k-inputSeq[k]+1+n)%n; rotate(inputSeq, inputSeq+pos, inputSeq+n); vi tmp; FOR(i, 0, n) tmp.pb(inputSeq[i]); sort(tmp.begin(), tmp.end()); FOR(i, 0, n-1) if(tmp[i] == tmp[i+1]) return false; FOR(i, 0, n){ if(inputSeq[i] <= n and inputSeq[i] != i+1) return false; } return true; } INT replacement(INT n, INT gondolaSeq[], INT replacementSeq[]){ valid(n, gondolaSeq); vii seq(n); FOR(i, 0, n) seq[i] = {gondolaSeq[i], i+1}; sort(&seq[0], &seq[n]); int j = n+1; vi ret; FOR(i, 0, n){ while(seq[i].fst != seq[i].snd) ret.pb(seq[i].snd), seq[i].snd = j++; } FOR(i, 0, ret.size()) replacementSeq[i] = ret[i]; return ret.size(); } INT countReplacement(INT n, INT inputSeq[]){ } signed main(){ int n; INT seq[NMAX], outSeq[NMAX]; cin >> n; FOR(i, 0, n) cin >> seq[i]; int l = replacement(n, seq, outSeq); FOR(i, 0, l) cout << outSeq[i] << " "; cout << endl; fast_io(); }

Compilation message (stderr)

gondola.cpp: In function 'INT replacement(INT, INT*, INT*)':
gondola.cpp:14:41: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
 #define FOR(i, l, r) for(int i = (l); i < (r); i++)
                                         ^
gondola.cpp:63:5: note: in expansion of macro 'FOR'
     FOR(i, 0, ret.size()) replacementSeq[i] = ret[i];
     ^~~
gondola.cpp: In function 'INT countReplacement(INT, INT*)':
gondola.cpp:69:1: warning: no return statement in function returning non-void [-Wreturn-type]
 }
 ^
/tmp/ccRKK196.o: In function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'
/tmp/ccMkBoxL.o:gondola.cpp:(.text.startup+0x0): first defined here
/tmp/ccRKK196.o: In function `main':
grader.cpp:(.text.startup+0xc3): undefined reference to `countReplacement'
grader.cpp:(.text.startup+0xe2): undefined reference to `valid'
grader.cpp:(.text.startup+0x106): undefined reference to `replacement'
collect2: error: ld returned 1 exit status