제출 #1121132

#제출 시각아이디문제언어결과실행 시간메모리
1121132SalihSahin저울 (IOI15_scales)C++14
71.43 / 100
2 ms592 KiB
#include <bits/stdc++.h> #define pb push_back using namespace std; #include "scales.h" vector<int> perm(6); void init(int T) { for(int i = 0; i < 6; i++) perm[i] = i+1; random_shuffle(perm.begin(), perm.end()); } void orderCoins(){ mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); random_shuffle(perm.begin(), perm.end()); shuffle(perm.begin(), perm.end(), rng); int W[6]; int x = getLightest(perm[0], perm[1], perm[2]); vector<int> rem; for(int i = 0; i < 3; i++){ if(perm[i] != x) rem.pb(perm[i]); } int y = getHeaviest(rem[0], rem[1], perm[3]); vector<int> rem2; for(int i = 0; i < 4; i++){ if(perm[i] != y && perm[i] != x) rem2.pb(perm[i]); } int z = getMedian(rem2[0], rem2[1], x); vector<int> l = {-1, -1, -1, y}; if(z == x){ l[1] = x; l[2] = rem2[0]; l[0] = rem2[1]; } else if(z == rem2[0]){ l[0] = x; l[1] = z; l[2] = rem2[1]; } else{ l[0] = x; l[1] = rem2[1]; l[2] = rem2[0]; } //for(int i = 0; i < 4; i++) cout<<l[i]<<" "; //cout<<endl; // 1, 2, 3, 4 ---- 5 ve 6 kaldı 3 islemde vector<int> l2 = {-1, -1, -1, -1, -1}; int k = getMedian(l[0], l[2], perm[4]); if(k == perm[4]){ int k2 = getMedian(l[0], l[1], perm[4]); if(k2 == l[1]) l2 = {l[0], l[1], perm[4], l[2], l[3]}; else l2 = {l[0], perm[4], l[1], l[2], l[3]}; } else if(k == l[0]) l2 = {perm[4], l[0], l[1], l[2], l[3]}; else if(k == l[2]){ int k2 = getMedian(l[2], l[3], perm[4]); if(k2 == l[3]) l2 = {l[0], l[1], l[2], l[3], perm[4]}; else l2 = {l[0], l[1], l[2], perm[4], l[3]}; } l = l2; //for(int i = 0; i < 5; i++) cout<<l[i]<<" "; //cout<<endl; vector<int> res = {-1, -1, -1, -1, -1, -1}; k = getMedian(l[1], l[3], perm[5]); if(k == perm[5]){ int k2 = getMedian(l[1], l[2], perm[5]); if(k2 == l[2]) res = {l[0], l[1], l[2], perm[5], l[3], l[4]}; else res = {l[0], l[1], perm[5], l[2], l[3], l[4]}; } else if(k == l[1]){ int k2 = getMedian(l[0], l[1], perm[5]); if(k2 == l[0]) res = {perm[5], l[0], l[1], l[2], l[3], l[4]}; else res = {l[0], perm[5], l[1], l[2], l[3], l[4]}; } else if(k == l[3]){ int k2 = getMedian(l[3], l[4], perm[5]); if(k2 == l[4]) res = {l[0], l[1], l[2], l[3], l[4], perm[5]}; else res = {l[0], l[1], l[2], l[3], perm[5], l[4]}; } for(int i = 0; i < 6; i++){ W[i] = res[i]; } 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...