제출 #1155344

#제출 시각아이디문제언어결과실행 시간메모리
1155344steveonalex저울 (IOI15_scales)C++20
0 / 100
1 ms320 KiB
/* ________ ___ ________ ________ ________ ___ ________ ________ ________ |\ ____\|\ \|\ ____\|\ __ \ |\ ___ \|\ \|\ ____\|\ ____\|\ __ \ \ \ \___|\ \ \ \ \___|\ \ \|\ \ \ \ \\ \ \ \ \ \ \___|\ \ \___|\ \ \|\ \ \ \ \ __\ \ \ \ \ __\ \ __ \ \ \ \\ \ \ \ \ \ \ __\ \ \ __\ \ __ \ \ \ \|\ \ \ \ \ \|\ \ \ \ \ \ \ \ \\ \ \ \ \ \ \|\ \ \ \|\ \ \ \ \ \ \ \_______\ \__\ \_______\ \__\ \__\ \ \__\\ \__\ \__\ \_______\ \_______\ \__\ \__\ \|_______|\|__|\|_______|\|__|\|__| \|__| \|__|\|__|\|_______|\|_______|\|__|\|__| ________ ________ ________ ________ ___ ___ ________ _________ ___ ________ ________ |\ __ \|\ __ \|\ __ \|\ ___ \|\ \|\ \|\ ____\\___ ___\\ \|\ __ \|\ ___ \ \ \ \|\ \ \ \|\ \ \ \|\ \ \ \_|\ \ \ \\\ \ \ \___\|___ \ \_\ \ \ \ \|\ \ \ \\ \ \ \ \ ____\ \ _ _\ \ \\\ \ \ \ \\ \ \ \\\ \ \ \ \ \ \ \ \ \ \ \\\ \ \ \\ \ \ \ \ \___|\ \ \\ \\ \ \\\ \ \ \_\\ \ \ \\\ \ \ \____ \ \ \ \ \ \ \ \\\ \ \ \\ \ \ \ \__\ \ \__\\ _\\ \_______\ \_______\ \_______\ \_______\ \ \__\ \ \__\ \_______\ \__\\ \__\ \|__| \|__|\|__|\|_______|\|_______|\|_______|\|_______| \|__| \|__|\|_______|\|__| \|__| Written by: giga nigga */ // #include "largest.h" #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef unsigned long long ull; #define MASK(i) (1ULL << (i)) #define GETBIT(mask, i) (((mask) >> (i)) & 1) #define ALL(v) (v).begin(), (v).end() ll max(ll a, ll b){return (a > b) ? a : b;} ll min(ll a, ll b){return (a < b) ? a : b;} ll gcd(ll a, ll b){return __gcd(a, b);} ll lcm(ll a, ll b){return a / gcd(a, b) * b;} ll LASTBIT(ll mask){return (mask) & (-mask);} int pop_cnt(ull mask){return __builtin_popcountll(mask);} int ctz(ull mask){return __builtin_ctzll(mask);} int logOf(ull mask){return 63 - __builtin_clzll(mask);} // mt19937_64 rng(chrono::high_resolution_clock::now().time_since_epoch().count()); mt19937_64 rng(1); ll rngesus(ll l, ll r){return l + (ull) rng() % (r - l + 1);} double rngesus_d(double l, double r){ double wow = (double) ((ull) rng()) / ((ull)(0-1)); return wow * (r - l) + l; } template <class T1, class T2> bool maximize(T1 &a, T2 b){ if (a < b) {a = b; return true;} return false; } template <class T1, class T2> bool minimize(T1 &a, T2 b){ if (a > b) {a = b; return true;} return false; } template <class T> void printArr(T container, string separator = " ", string finish = "\n", ostream &out = cout){ for(auto item: container) out << item << separator; out << finish; } template <class T> void remove_dup(vector<T> &a){ sort(ALL(a)); a.resize(unique(ALL(a)) - a.begin()); } #include "scales.h" void init(int T); void orderCoins(); namespace InteractorLib{ int o_cnt = 0; vector<int> perm; vector<int> no_king; int getHeaviest(int i, int j, int k, int cost = 1){ o_cnt += cost; if (perm[i] > perm[j] && perm[i] > perm[k]) return i; if (perm[j] > perm[k]) return j; return k; } int getLightest(int i, int j, int k, int cost = 1){ o_cnt += cost; if (perm[i] < perm[j] && perm[i] < perm[k]) return i; if (perm[j] < perm[k]) return j; return k; } int getMedian(int i, int j, int k, int cost = 1){ o_cnt += cost; return i ^ j ^ k ^ getHeaviest(i, j, k, 0) ^ getLightest(i, j, k, 0); } void answer(int ans[]){ no_king.resize(7); for(int i = 1; i <= 6; ++i) no_king[ans[i-1]] = i; } double grade(){ int t = 10000; init(t); o_cnt = 0; for(int it = 0; it < t; ++it){ perm.resize(7); for(int i = 1; i <= 6; ++i) perm[i] = i; shuffle(1+ALL(perm), rng); orderCoins(); if (perm != no_king) return 0; } return (double) 6 * t / max(6, o_cnt); } } void init(int T) { } void orderCoins() { vector<int> S; for(int i = 1; i <= 6; ++i) S.push_back(i); int ans[6]; for(int i = 0; i< 4; ++i){ int mi = S[0]; for(int j = 1; j < (int)S.size(); j += 2){ minimize(j, S.size() - 2); mi = getLightest(mi, S[j], S[j+1]); } ans[i] = mi; for(int j = 0; j < (int) S.size(); ++j) if (S[j] == mi){ S.erase(S.begin() + j); break; } } int ma = getHeaviest(ans[0], S[0], S[1]); ans[5] = ma; ans[4] = ma ^ S[0] ^ S[1]; answer(ans); }
#Verdict Execution timeMemoryGrader output
Fetching results...