Submission #1207380

#TimeUsernameProblemLanguageResultExecution timeMemory
1207380SorahISARotating Lines (APIO25_rotate)C++20
100 / 100
31 ms2160 KiB
#ifndef SorahISA #define SorahISA #include SorahISA __FILE__ SorahISA namespace { const int maxc = 50'000; void Rotate(vector<int> t, int x) { x = (x % maxc + maxc) % maxc; return rotate(t, x); } } void energy(int n, vector<int> v) { vector<int> id(n); iota(ALL(id), 0); sort(ALL(id), [&](int i, int j) { return v[i] < v[j]; }); for (int i = 0; i < n/2; ++i) Rotate({id[i + n/2]}, v[id[i]] - v[id[i + n/2]] + maxc / 2); } #else #ifdef local #include "C/cpp/rotate.h" #else #include "rotate.h" #endif #include <bits/stdc++.h> using namespace std; using i32 = int; using i64 = long long; // #define int i64 using pii = pair<int, int>; template <typename T> using MaxHeap = std::priority_queue<T>; template <typename T> using MinHeap = std::priority_queue<T, vector<T>, greater<T>>; // #define X first // #define Y second #define eb emplace_back #define ef emplace_front #define ee emplace #define pb pop_back #define pf pop_front #define ALL(x) begin(x), end(x) #define RALL(x) rbegin(x), rend(x) #define SZ(x) ((int)(x).size()) template <typename T, typename U> ostream & operator << (ostream &os, const pair<T, U> &p) { return os << p.first << " " << p.second; } template <typename T> ostream & operator << (ostream &os, const vector<T> &v) { for (int i = 0; i < ssize(v); ++i) { if (i) os << " "; os << v[i]; } return os; } #ifdef local #define debug(...) \ fprintf(stderr, "\u001b[33m"), \ fprintf(stderr, "At [%s], line %d: (%s) = ", __FUNCTION__, __LINE__, #__VA_ARGS__), \ _do(__VA_ARGS__), \ fprintf(stderr, "\u001b[0m") template <typename T> void _do(T &&_t) { cerr << _t << "\n"; } template <typename T, typename ...U> void _do(T &&_t, U &&..._u) { cerr << _t << ", ", _do(_u...); } #else #define debug(...) void() #endif template <typename T, typename U> bool chmin(T &lhs, U rhs) { return lhs > rhs ? lhs = rhs, 1 : 0; } template <typename T, typename U> bool chmax(T &lhs, U rhs) { return lhs < rhs ? lhs = rhs, 1 : 0; } #endif
#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...