Submission #432218

#TimeUsernameProblemLanguageResultExecution timeMemory
432218jeqchoScales (IOI15_scales)C++17
14.29 / 100
1 ms292 KiB
#include "scales.h" #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; typedef pair<int,int> pii; typedef vector<int> vi; typedef vector<pii> vpi; #define FOR(i,a,b) for(int i=a;i<b;++i) #define F0R(i,b) FOR(i,0,b) #define ROF(i,a,b) for(int i=b-1;i>=a;--i) #define R0F(i,b) ROF(i,0,b) #define trav(a,x) for(auto&a:x) #define all(x) begin(x),end(x) #define fi first #define se second #define pb push_back #define sz(x) int(x.size()) void init(int T) { /* ... */ } vi decode(int mask) { vi cur(3); int idx=0; F0R(i,6) { if(mask&(1<<i)) { cur[idx]=i+1; ++idx; } } return cur; } void orderCoins() { vi cnt(6); F0R(i,1<<6) { int pc=__builtin_popcount(i); if(pc!=3)continue; vi v = decode(i); int mx = getHeaviest(v[0],v[1],v[2]); --mx; ++cnt[mx]; } vpi rank; F0R(i,6) { rank.pb({cnt[i],i+1}); } sort(all(rank)); int mn = getLightest(rank[0].se,rank[1].se,rank[2].se); if(mn==rank[1].se)swap(rank[0],rank[1]); int W[6]; F0R(i,6) { W[i]=rank[i].se; } answer(W); }

Compilation message (stderr)

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