제출 #1322728

#제출 시각아이디문제언어결과실행 시간메모리
1322728limitiymArt Collections (BOI22_art)C++20
100 / 100
800 ms189436 KiB
#include "art.h" #include <iostream> #include <vector> #include <algorithm> #include <cmath> #include <map> #include <set> #include <numeric> #include <deque> #include <random> #include <unordered_map> #include <unordered_set> #include <queue> #include <stack> #include <string> #include <iomanip> #include <fstream> #include <bitset> #include <ctime> #include <cstdio> #include <chrono> #include <functional> #include <cassert> #include <list> #include <iterator> // #include <ext/pb_ds/assoc_container.hpp> // using namespace __gnu_pbds; using namespace std; #ifdef LOCAL bool local = true; #else bool local = false; #endif /*<-------DEFINES START------->*/ #define all(x) x.begin(), x.end() #define rall(x) x.rbegin(), x.rend() #define for1(n) for (int i = 1; i < n; ++i) #define for0(n) for (int i = 0; i < n; ++i) #define rep(i, j, n) for (int i = (j); i < (n); ++i) #define rrep(i, j, n) for (int i = (j); i >= (n); --i) #define debug(fmt, ...) \ fprintf(stderr, "[%d] " fmt "\n", LINE, ##__VA_ARGS__) #define lb lower_bound #define ub upper_bound #define rsun(a) a.resize(unique(a.begin(), a.end())-a.begin()) #define re return #define con continue #define pb push_back #define pob pop_back; #define sz(x) (int)size(x) #define fi first #define se second using ll = long long; using ull = unsigned long long; using ld = long double; using vi = vector<int>; using vll = vector<long long>; using pii = pair<int, int>; using pll = pair<long long, long long>; using vvi = vector<vector<int>>; using vvvi = vector<vector<vector<int>>>; using vvll = vector<vector<long long>>; using vpii = vector<pair<long long, long long>>; using vvpii = vector<vpii>; /*<-------DEFINES END------->*/ /*<-------TEMPLATES START------->*/ template<typename T> istream& operator>>(istream& in, vector<T>& a) { for (T& i : a) in >> i; return in; } template<typename T1, typename T2> istream& operator>>(istream& in, pair<T1, T2>& a) { in >> a.fi >> a.se; return in; } template<typename T1, typename T2> ostream& operator<<(ostream& out, pair<T1, T2>& a) { out << a.fi << " " << a.se; return out; } template<typename T1, typename T2> istream& operator>>(istream& in, vector<pair<T1, T2>>& a) { for (pair<T1, T2>& i : a) in >> i.fi >> i.se; return in; } template<typename T> ostream& operator<<(ostream& out, const vector<T>& a) { for (auto i : a) { out << i << " "; } return out; } template<typename T1, typename T2> ostream& operator<<(ostream& out, vector<pair<T1, T2>>& a) { for (pair<T1, T2> i : a) out << i.fi << " " << i.se << endl; return out; } template<typename T1> ostream& operator<<(ostream& out, vector<vector<T1>>& a) { for (vector<T1> i : a) { for (T1 j : i) out << j << " "; out << endl; } return out; } template<typename T1, typename T2> inline T1 min(T1 a, T2 b) { b = (T1)b; return a > b ? b : a; } template<typename T1, typename T2> inline T1 max(T1 a, T2 b) { b = (T1)b; return a > b ? a : b; } template<typename T1, typename T2> inline void amin(T1& a, T2 b) { a = min(a, b); } template<typename T1, typename T2> inline void amax(T1& a, T2 b) { a = max(a, b); } /*<-------TEMPLATES END------->*/ double getTime() { return clock() / (double)CLOCKS_PER_SEC; } int randint(int start, int end) { return rand() % (end - start + 1) + start; } void solve(int N) { vi p(N); iota(all(p), 1); map<vi, int> mp; map<int, vi> mp2, mp3; mp[p] = publish(p); rep(i, 0, N - 1) { p.insert(p.begin(), p.back()); p.pop_back(); mp[p] = publish(p); } for (auto [x, y] : mp) { mp2[x[0]] = x; mp3[x.back()] = x; } p.insert(p.begin(), p.back()); p.pop_back(); vi ans(N); rep(i, 1, N + 1) { int l1 = mp[mp2[i]]; int l2 = mp[mp3[i]]; ans[(l1 - l2 + N - 1) / 2] = i; } answer(ans); }
#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...