제출 #604369

#제출 시각아이디문제언어결과실행 시간메모리
604369cheissmart저울 (IOI15_scales)C++14
45.45 / 100
1 ms212 KiB
#include "scales.h" #include <bits/stdc++.h> #define F first #define S second #define V vector #define PB push_back #define EB emplace_back #define MP make_pair #define SZ(v) int((v).size()) #define ALL(v) (v).begin(), (v).end() using namespace std; typedef long long ll; typedef pair<int, int> pi; typedef V<int> vi; const int INF = 1e9 + 7; void init(int T) { } void orderCoins() { vi ans(6); iota(ALL(ans), 1); auto go = [&] (int x, int y, int z) { int a = ans[x], b = ans[y], c = ans[z]; int mx = getHeaviest(a, b, c); int mn = getLightest(a, b, c); int md = a ^ b ^ c ^ mx ^ mn; ans[x] = mn, ans[y] = md, ans[z] = mx; }; auto go1 = [&] (int x, int y, int z) { // ans[x] < ans[y] int a = ans[x], b = ans[y], c = ans[z]; int md = getMedian(a, b, c); if(md == a) ans[x] = c, ans[y] = a, ans[z] = b; else if(md == c) ans[x] = a, ans[y] = c, ans[z] = b; }; auto go2 = [&] (int x, int y, int z) { // ans[y] < ans[z] int a = ans[x], b = ans[y], c = ans[z]; int md = getMedian(a, b, c); if(md == a) ans[x] = b, ans[y] = a, ans[z] = c; else if(md == c) ans[x] = b, ans[y] = c, ans[z] = a; }; go(0, 1, 2); go1(1, 2, 3); go2(0, 1, 2); { // insert 4 int tt = getNextLightest(ans[0], ans[1], ans[2], ans[4]); int val = ans[4]; ans.erase(ans.begin() + 4); if(tt == ans[1]) { ans.insert(ans.begin() + 1, val); } else if(tt == ans[2]) { ans.insert(ans.begin() + 2, val); } else { int md = getMedian(ans[0], ans[3], val); if(md == ans[0]) ans.insert(ans.begin(), val); else if(md == ans[3]) ans.insert(ans.begin() + 4, val); else ans.insert(ans.begin() + 3, val); } } { // insert 5 int tt = getNextLightest(ans[2], ans[3], ans[4], ans[5]); int val = ans[5]; ans.erase(ans.begin() + 5); if(tt == ans[3]) { ans.insert(ans.begin() + 3, val); } else if(tt == ans[4]) { ans.insert(ans.begin() + 4, val); } else { int ttt = getNextLightest(ans[0], ans[1], ans[2], val); if(ttt == ans[1]) { ans.insert(ans.begin() + 1, val); } else if(ttt == ans[2]) { ans.insert(ans.begin() + 2, val); } else { if(getLightest(ans[0], ans[4], val) == val) ans.insert(ans.begin(), val); else ans.insert(ans.begin() + 5, val); } } } int W[] = {ans[0], ans[1], ans[2], ans[3], ans[4], ans[5]}; answer(W); }

컴파일 시 표준 에러 (stderr) 메시지

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