Submission #286292

#TimeUsernameProblemLanguageResultExecution timeMemory
286292AaronNaiduScales (IOI15_scales)C++14
Compilation error
0 ms0 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() { vector<int> answerVector; 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.push_back(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.push_back(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.push_back(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.push_back(lightest1); int med1 = getMedian(newOrigVector[0], newOrigVector[1], newOrigVector[2]); answerVector.push_back(med1); for (int i = 0; i < 3; i++) { if (newOrigVector[i] != lightest1 and newOrigVector[i] != med1) { answerVector.push_back(newOrigVector[i]); } } answer(answerVector); }

Compilation message (stderr)

scales.cpp: In function 'void orderCoins()':
scales.cpp:95:12: error: cannot convert 'std::vector<int>' to 'int*'
   95 |     answer(answerVector);
      |            ^~~~~~~~~~~~
      |            |
      |            std::vector<int>
In file included from scales.cpp:2:
scales.h:10:17: note:   initializing argument 1 of 'void answer(int*)'
   10 | void answer(int W[]);
      |             ~~~~^~~