Submission #1253589

#TimeUsernameProblemLanguageResultExecution timeMemory
1253589antonnRotating Lines (APIO25_rotate)C++20
16 / 100
97 ms4224 KiB
#include "rotate.h" #include<bits/stdc++.h> using namespace std; typedef long long ll; template<typename T> bool assign_min(T& a, T b) { if (a > b) { a = b; return true; } return false; } template<typename T> bool assign_max(T& a, T b) { if (a < b) { a = b; return true; } return false; } void energy(int n, vector<int> v) { vector<int> ord(n); iota(ord.begin(), ord.end(), 0); sort(ord.begin(), ord.end(), [&](int x, int y) { return v[x] < v[y]; }); int half = n / 2; vector<vector<int>> rot(20); for (int i = 0; i < half; i++) { int want = (v[ord[i]] + 25000) % 50000; int x = (want - v[ord[i + half]] + 50000) % 50000; for (int b = 0; b < 20; b++) { if (x & (1 << b)) { rot[b].push_back(ord[i + half]); } } } for (int b = 19; b >= 0; b--) { if (rot[b].empty()) { continue; } rotate(rot[b], (1 << b)); } }
#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...