Submission #604416

#TimeUsernameProblemLanguageResultExecution timeMemory
604416wiwihoScales (IOI15_scales)C++14
56.60 / 100
1 ms212 KiB
#include "scales.h" #include <bits/stdc++.h> #define iter(a) a.begin(), a.end() #define lsort(a) sort(iter(a)) #define gsort(a) sort(iter(a), greater<>()) #define eb emplace_back #define ef emplace_front #define pob pop_back() #define pof pop_front() #define mp make_pair #define F first #define S second #define uni(a) a.resize(unique(iter(a)) - a.begin()) #define printv(a, b){ \ for(auto pv : a) b << pv << " "; \ b << "\n"; \ } using namespace std; typedef long long ll; typedef long double ld; using pii = pair<int, int>; using pll = pair<ll, ll>; template<typename A, typename B> ostream& operator<<(ostream& o, pair<A, B> p){ return o << '(' << p.F << ',' << p.S << ')'; } mt19937 rnd(clock()); void init(int T){ } int tt = 0; vector<int> solve(){ tt++; cerr << "solve " << tt << "\n"; vector<int> T = {1, 2, 3, 4, 5, 6}; shuffle(iter(T), rnd); vector<int> A, B; { int l = getLightest(T[0], T[1], T[2]); int r = getHeaviest(T[0], T[1], T[2]); A.eb(l); A.eb(l ^ r ^ T[0] ^ T[1] ^ T[2]); A.eb(r); } { int l = getLightest(T[3], T[4], T[5]); int r = getHeaviest(T[3], T[4], T[5]); B.eb(l); B.eb(l ^ r ^ T[3] ^ T[4] ^ T[5]); B.eb(r); } printv(A, cerr); printv(B, cerr); int tmp = getMedian(A[1], A[2], B[2]); cerr << tmp << "\n"; if(tmp == A[2]){ // A[0] A[1] A[2] B[2] tmp = getMedian(A[1], A[2], B[1]); if(tmp == A[2]){ // A[0] A[1] A[2] B[1] B[2] tmp = getMedian(A[0], A[1], B[0]); if(tmp == A[0]) return {B[0], A[0], A[1], A[2], B[1], B[2]}; else if(tmp == B[0]) return {A[0], B[0], A[1], A[2], B[1], B[2]}; else{ tmp = getMedian(A[1], B[0], A[2]); if(tmp == B[0]) return {A[0], A[1], B[0], A[2], B[1], B[2]}; else return {A[0], A[1], A[2], B[0], B[1], B[2]}; } } else if(tmp == B[1]){ // A[0] A[1] B[1] A[2] B[2] tmp = getMedian(A[0], A[1], B[0]); if(tmp == A[1]) return {A[0], A[1], B[0], B[1], A[2], B[2]}; else if(tmp == B[0]) return {A[0], B[0], A[1], B[1], A[2], B[2]}; else return {B[0], A[0], A[1], B[1], A[2], B[2]}; } else{ // B[1] A[1] A[2] B[2] tmp = getMedian(A[0], B[0], B[1]); if(tmp == B[0]) return {A[0], B[0], B[1], A[1], A[2], B[2]}; else if(tmp == A[0]) return {B[0], A[0], B[1], A[1], A[2], B[2]}; else return {B[0], B[1], A[0], A[1], A[2], B[2]}; } } else if(tmp == B[2]){ // A[0] A[1] B[2] A[2] tmp = getMedian(A[0], A[1], B[1]); if(tmp == A[1]){ // A[0] A[1] B[1] B[2] A[2] tmp = getMedian(A[0], A[1], B[0]); if(tmp == A[1]) return {A[0], A[1], B[0], B[1], B[2], A[2]}; else if(tmp == B[0]) return {A[0], B[0], A[1], B[1], B[2], A[2]}; else return {B[0], A[0], A[1], B[1], B[2], A[2]}; } else if(tmp == B[1]){ // A[0] B[1] A[1] B[2] A[2] tmp = getMedian(B[0], A[0], B[1]); if(tmp == A[0]) return {B[0], A[0], B[1], A[1], B[2], A[2]}; else return {A[0], B[0], B[1], A[1], B[2], A[2]}; } else{ return {B[0], B[1], A[0], A[1], B[2], A[2]}; } } else{ // B[0] B[1] B[2] A[1] A[2] tmp = getMedian(B[0], B[1], A[0]); if(tmp == B[0]) return {A[0], B[0], B[1], B[2], A[1], A[2]}; else if(tmp == A[0]) return {B[0], A[0], B[1], B[2], A[1], A[2]}; else{ tmp = getMedian(A[0], B[2], A[1]); if(tmp == B[2]) return {B[0], B[1], A[0], B[2], A[1], A[2]}; else return {B[0], B[1], B[2], A[0], A[1], A[2]}; } } } void orderCoins(){ vector<int> ans = solve(); int av[6]; for(int i = 0; i < 6; i++) av[i] = ans[i]; answer(av); }

Compilation message (stderr)

scales.cpp: In function 'void init(int)':
scales.cpp:36:15: warning: unused parameter 'T' [-Wunused-parameter]
   36 | void init(int T){
      |           ~~~~^
#Verdict Execution timeMemoryGrader output
Fetching results...