제출 #286293

#제출 시각아이디문제언어결과실행 시간메모리
286293AaronNaidu저울 (IOI15_scales)C++14
45.45 / 100
1 ms384 KiB
#include <bits/stdc++.h> #include "scales.h" using namespace std; int t; void init(int T) { t = T; } /*int getLightest(int a, int b, int c) { cout << "Lightest of " << a << " " << b << " " << c << "\n"; int ans; cin >> ans; return ans; } int getMedian(int a, int b, int c) { cout << "Median of " << a << " " << b << " " << c << "\n"; int ans; cin >> ans; return ans; } void answer(vector<int> v) { cout << "Answer:\n"; for (auto i : v) { cout << i << " "; } }*/ void orderCoins() { int answerVector[6]; int lightest1 = getLightest(1, 2, 3); lightest1 = getLightest(lightest1, 4, 5); if (lightest1 == 5) { lightest1 = getLightest(lightest1, 4, 6); } else { lightest1 = getLightest(lightest1, 5, 6); } answerVector[0] = (lightest1); vector<int> origVector; for (int i = 1; i < 7; i++) { if (i != lightest1) { origVector.push_back(i); } } lightest1 = getLightest(origVector[0], origVector[1], origVector[2]); lightest1 = getLightest(lightest1, origVector[3], origVector[4]); answerVector[1] = (lightest1); vector<int> newOrigVector; for (int i = 0; i < 5; i++) { if (origVector[i] != lightest1) { newOrigVector.push_back(origVector[i]); } } origVector = newOrigVector; newOrigVector.clear(); lightest1 = getLightest(origVector[0], origVector[1], origVector[2]); if (lightest1 == origVector[0]) { lightest1 = getLightest(lightest1, origVector[1], origVector[3]); } else { lightest1 = getLightest(lightest1, origVector[0], origVector[3]); } answerVector[2] = (lightest1); for (int i = 0; i < 4; i++) { if (origVector[i] != lightest1) { newOrigVector.push_back(origVector[i]); } } lightest1 = getLightest(newOrigVector[0], newOrigVector[1], newOrigVector[2]); answerVector[3] = (lightest1); int med1 = getMedian(newOrigVector[0], newOrigVector[1], newOrigVector[2]); answerVector[4] = (med1); for (int i = 0; i < 3; i++) { if (newOrigVector[i] != lightest1 and newOrigVector[i] != med1) { answerVector[5] = (newOrigVector[i]); } } answer(answerVector); }
#Verdict Execution timeMemoryGrader output
Fetching results...