Submission #219138

#TimeUsernameProblemLanguageResultExecution timeMemory
219138summitweiGondola (IOI14_gondola)C++17
20 / 100
40 ms5240 KiB
#include <bits/stdc++.h> #include <gondola.h> using namespace std; typedef vector<int> vi; typedef vector<pair<int, int> > vpii; typedef pair<int, int> pii; typedef long long ll; typedef pair<ll, ll> pll; typedef pair<double, double> pdd; typedef vector<ll> vll; #define INF 0x3f3f3f3f #define MOD 1000000007LL #define EPSILON 0.00001 #define f first #define s second #define pb push_back #define mp make_pair #define FOR(i, a, b) for (ll i=(a); i<=(signed)(b); i++) #define F0R(i, a) for (ll i=0; i<(signed)(a); i++) #define RFOR(i, a, b) for (ll i=(a); i >= b; i--) #define MN 100005 int rep[MN*2]; int valid(int n, int inputSeq[]){ F0R(i, n) rep[i] = rep[i+n] = inputSeq[i]; int loc = min_element(rep, rep+2*n)-rep; F0R(i, n) inputSeq[i] = rep[i+loc]; set<int> hmm; int v = -1; if(inputSeq[0] <= n) v = inputSeq[0]; F0R(i, n){ if(hmm.count(rep[i])) return 0; hmm.insert(rep[i]); if(inputSeq[i]<=n && inputSeq[i]-i != v) return 0; } return 1; } int replacement(int n, int gondolaSeq[], int replacementSeq[]){ //return 0; valid(n, gondolaSeq); map<int, int> ree; int v = 1; if(gondolaSeq[0] <= n) v = gondolaSeq[0]; F0R(i, n){ if(gondolaSeq[i] > n) ree[gondolaSeq[i]] = i+v; } if(ree.empty()){ return 0; } int mx = (--ree.end())->f; int cur = (--ree.end())->s; FOR(i, n+1, mx){ if(ree[i] == 0){ replacementSeq[i-n-1] = cur; cur = i; } else if(i == mx){ replacementSeq[i-n-1] = cur; } else{ replacementSeq[i-n-1] = ree[i]; } } return mx-n; } int countReplacement(int n, int inputSeq[]){ return 0; } /*int main(){ ios_base::sync_with_stdio(false); cin.tie(0); int a[3] = {3, 1, 4}; int b[5] = {5, 1, 2, 3, 4}; int c[7] = {2, 3, 4, 9, 6, 7, 1}; int ans[10]; int x = replacement(3, a, ans); cout << x << "\n"; F0R(i, x) cout << ans[i] << " "; cout << "\n"; x = replacement(5, b, ans); cout << x << "\n"; F0R(i, x) cout << ans[i] << " "; cout << "\n"; x = replacement(7, c, ans); cout << x << "\n"; F0R(i, x) cout << ans[i] << " "; cout << "\n"; return 0; }*/
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...