제출 #520322

#제출 시각아이디문제언어결과실행 시간메모리
520322silverfish저울 (IOI15_scales)C++17
0 / 100
2 ms1740 KiB
#include "scales.h" #include <bits/stdc++.h> using namespace std; #define pb push_back const int INF = 1000; int ans[999999][6]; int light(int a, int b, int c){ vector<int> v = {a,b,c}; sort(v.begin(), v.end()); return v[0]; } int mid(int a, int b, int c){ vector<int> v = {a,b,c}; sort(v.begin(), v.end()); return v[1]; } int heavy(int a, int b, int c){ vector<int> v = {a,b,c}; sort(v.begin(), v.end()); return v[2]; } int nextl(int a, int b, int c, int d){ vector<int> v = {b,c,d}; sort(v.begin(), v.end()); if(heavy(b,c,d) < a) return light(b,c,d); else return *upper_bound(v.begin(), v.end(), a); } void init(int T) { vector<int> p = {1, 2, 3, 4, 5, 6}; do{ vector<int> q; q.pb(nextl(p[2], p[3],p[5], p[0])); q.pb(nextl(p[3], p[4],p[5], p[0])); q.pb(nextl(p[5], p[0],p[4], p[1])); q.pb(nextl(p[0], p[1],p[3], p[4])); q.pb(nextl(p[4], p[2],p[5], p[1])); q.pb(nextl(p[1], p[4],p[3], p[2])); reverse(q.begin(), q.end()); int mul = 1, cur = 0; for(int x : q){ cur += mul*x; mul *= 10; } int v = 0; mul = 1; for(int i = 0; i < 6; ++i){ ans[cur][i] = p[i]; } }while(next_permutation(p.begin(), p.end())); return; } void orderCoins() { int p[] = {1, 2, 3, 4, 5, 6}; vector<int> q; q.pb(getNextLightest(p[2], p[3],p[5], p[0])); q.pb(getNextLightest(p[3], p[4],p[5], p[0])); q.pb(getNextLightest(p[5], p[0],p[4], p[1])); q.pb(getNextLightest(p[0], p[1],p[3], p[4])); q.pb(getNextLightest(p[4], p[2],p[5], p[1])); q.pb(getNextLightest(p[1], p[4],p[3], p[2])); reverse(q.begin(), q.end()); int mul = 1, cur = 0; for(int x : q){ cur += mul*x; mul *= 10; } //cout << cur << endl; answer(ans[cur]); return; }

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

scales.cpp: In function 'void init(int)':
scales.cpp:50:7: warning: unused variable 'v' [-Wunused-variable]
   50 |   int v = 0;
      |       ^
scales.cpp:34:15: warning: unused parameter 'T' [-Wunused-parameter]
   34 | void init(int T) {
      |           ~~~~^
#Verdict Execution timeMemoryGrader output
Fetching results...