제출 #619863

#제출 시각아이디문제언어결과실행 시간메모리
619863yanndev저울 (IOI15_scales)C++17
33.33 / 100
1 ms212 KiB
#include "scales.h" #include <bits/stdc++.h> using namespace std; int mx = -1; map<pair<int, int>, bool> comp {}; void init(int T) { /* ... */ } bool comp1(int a, int b) { if (comp.find({a, b}) != comp.end()) return comp[{a, b}]; int c = -1; for (int i = 1; i <= 6; i++) if (i != a && i != b) c = i; int small = getLightest(a, b, c); int big = getHeaviest(a, b, c); if (a == small) { comp[{a, b}] = comp[{b, a}] = true; comp[{a, c}] = comp[{c, a}] = true; } if (a == big) { comp[{a, b}] = comp[{b, a}] = false; comp[{a, c}] = comp[{c, a}] = false; } if (b == small) { comp[{a, b}] = comp[{b, a}] = true; comp[{a, c}] = comp[{c, a}] = true; } if (b == big) { comp[{a, b}] = comp[{b, a}] = false; comp[{b, c}] = comp[{c, b}] = false; } if (c == small) { comp[{a, b}] = comp[{b, a}] = true; comp[{a, c}] = comp[{c, a}] = true; } if (c == big) { comp[{a, b}] = comp[{b, a}] = false; comp[{a, c}] = comp[{c, a}] = false; } if (b == big || a == small) { comp[{a, b}] = comp[{b, a}] = true; return true; } if (b == small || a == big) { comp[{a, b}] = comp[{b, a}] = false; return false; } return false; } bool comp2(int a, int b) { if (a == b) return false; if (comp.find({a, b}) != comp.end()) return comp[{a, b}]; if (b == mx) { comp[{a, b}] = true; comp[{b, a}] = false; return true; } if (a == mx) { comp[{a, b}] = false; comp[{b, a}] = true; return false; } int small = getLightest(a, b, mx); comp[{a, b}] = comp[{b, a}] = small == a; return small == a; } void orderCoins() { /* ... */ int W[] = {1, 2, 3, 4, 5, 6}; comp.clear(); vector<int> cur {}; for (int i = 1; i <= 6; i++) { if ((int)cur.size() < 3) { cur.push_back(i); } if ((int)cur.size() == 3) { mx = getHeaviest(cur[0], cur[1], cur[2]); cur = {mx}; } } if ((int)cur.size() > 1) { for (int i = 1; (int)cur.size() < 3 && i <= 6; i++) { if (find(cur.begin(), cur.end(), i) == cur.end()) { cur.push_back(i); } } mx = getHeaviest(cur[0], cur[1], cur[2]); } //cout << "mx is " << mx << '\n'; stable_sort(W, W + 6, comp2); answer(W); }

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

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