Submission #436574

#TimeUsernameProblemLanguageResultExecution timeMemory
436574jeqchoScales (IOI15_scales)C++17
45.45 / 100
5 ms204 KiB
#include "scales.h" #include <bits/stdc++.h> using namespace std; typedef long double ld; typedef long long ll; typedef pair<int,int> pii; typedef vector<int> vi; typedef vector<pair<int,int>> vpi; #define FOR(i,a,b) for (int i = (a); i < (b); ++i) #define F0R(i,a) FOR(i,0,a) #define ROF(i,a,b) for (int i = (b)-1; i >= (a); --i) #define R0F(i,a) ROF(i,0,a) #define trav(a,x) for (auto& a: x) #define pb push_back #define rsz resize #define sz(x) int(x.size()) #define all(x) begin(x), end(x) #define fi first #define se second void init(int T) { /* ... */ } vi so(vi o) { int h=getHeaviest(o[0],o[1],o[2]); int l=getLightest(o[0],o[1],o[2]); int m; F0R(i,3)if(o[i]!=h&&o[i]!=l)m=o[i]; return {l,m,h}; } void orderCoins() { vi s1 = so({1,2,3}); vi s2 = so({4,5,6}); vi ans; while(!s1.empty()&&!s2.empty()) { int u1=s1.back(); int u2=s2.back(); int mn; if(u1==s1.front())mn=s2.front(); else mn=s1.front(); if(mn==u2) { int l=getLightest(u1,u2,ans.back()); if(l==u1) { s2.pop_back(); ans.pb(u2); } else { s1.pop_back(); ans.pb(u1); } } else { int h=getHeaviest(u1,u2,mn); if(h!=u1)s2.pop_back(); else s1.pop_back(); ans.pb(h); } } reverse(all(s1)); reverse(all(s2)); ans.insert(ans.end(),all(s1)); ans.insert(ans.end(),all(s2)); reverse(all(ans)); int W[6]; F0R(i,6)W[i]=ans[i]; answer(W); }

Compilation message (stderr)

scales.cpp: In function 'void init(int)':
scales.cpp:25:15: warning: unused parameter 'T' [-Wunused-parameter]
   25 | void init(int T) {
      |           ~~~~^
scales.cpp: In function 'vi so(vi)':
scales.cpp:35:15: warning: 'm' may be used uninitialized in this function [-Wmaybe-uninitialized]
   35 |  return {l,m,h};
      |               ^
#Verdict Execution timeMemoryGrader output
Fetching results...