Submission #586556

#TimeUsernameProblemLanguageResultExecution timeMemory
586556Red_InsideGondola (IOI14_gondola)C++17
20 / 100
11 ms1800 KiB
#include "gondola.h" #include <bits/stdc++.h> using namespace std; #define ll long long #define f first #define s second #define forn(j, i, n) for(int i = j; i <= n; ++i) #define FOR(j, i, n) for(int i = j; i < n; ++i) #define nfor(j, i, n) for(int i = n; i >= j; --i) #define IOS ios_base::sync_with_stdio(false), cin.tie(), cout.tie(); #define all(v) v.begin(), v.end() #define pb push_back const int maxn = 3e5+100; //#define int ll #define pii pair <int, int> int inf = 1e9; mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); int a[maxn], was[maxn], b[maxn]; int valid(int n, int inputSeq[]) { forn(1, i, n) { a[i] = inputSeq[i-1]; was[a[i]]++; if(was[a[i]] >= 2) { return 0; } } int start = -1; forn(1, i, n) { if(a[i] <= n) { start = i - a[i] + 1; break; } } if(start == -1) return 1; forn(1, i, n) { b[(i-start+n)%n+1] = a[i]; } forn(1, i, n) { if(b[i] > n) continue; if(b[i] != i) return 0; } return 1; } int replacement(int n, int gondolaSeq[], int replacementSeq[]) { forn(1, i, n) { a[i] = gondolaSeq[i-1]; } set <pii> st; forn(1, i, n) { if(a[i] > n) { st.insert({a[i], i}); } } int cur = 0; while(st.size()) { replacementSeq[cur] = st.begin()->s; if(n + cur + 1 == st.begin()->f) { st.erase(st.begin()); } cur++; } return cur; } //---------------------- int countReplacement(int n, int inputSeq[]) { return -3; }
#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...