제출 #436782

#제출 시각아이디문제언어결과실행 시간메모리
436782Tangent곤돌라 (IOI14_gondola)C++17
55 / 100
35 ms4476 KiB
#include "gondola.h" #include "bits/stdc++.h" using namespace std; typedef long long ll; typedef pair<int, int> pii; typedef pair<ll, ll> pll; typedef vector<int> vii; typedef vector<ll> vll; typedef vector<pii> vpii; typedef vector<pll> vpll; typedef vector<vii> vvii; typedef vector<vll> vvll; typedef vector<vpii> vvpii; typedef vector<vpll> vvpll; #define ffor(i, a, b) for (ll i = (a); i < (ll)(b); i++) #define fford(i, a, b) for (ll i = (a); i > (ll)(b); i--) #define rep(i, n) ffor(i, 0, n) #define forin(x, a) for (auto &x: a) #define all(a) a.begin(), a.end() int valid(int n, int s[]) { int original = -1; map<int, int> counts; rep(i, n) { if (s[i] < 1) return 0; if (counts[s[i]]) return 0; counts[s[i]] = 1; if (s[i] <= n) { if (original == -1) { original = i; } else { if ((i + s[original]) % n != (s[i] + original) % n) { return 0; } } } } return 1; } //---------------------- int replacement(int n, int s[], int r[]) { vpii changed; int offset = 0; rep(i, n) { if (s[i] > n) { changed.emplace_back(s[i], i); } else { offset = (s[i] - i - 1 + n) % n; } } sort(all(changed)); int curr = n; forin(change, changed) { int val = (change.second + offset) % n + 1; while (curr < change.first) { r[curr++ - n] = val; val = curr; } } return curr - n; } //---------------------- int countReplacement(int n, int s[]) { 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...