Submission #619634

#TimeUsernameProblemLanguageResultExecution timeMemory
619634MounirScales (IOI15_scales)C++14
45.45 / 100
1 ms304 KiB
#include "scales.h" #include <bits/stdc++.h> #define all(x) x.begin(), x.end() #define chmax(x, v) x = max(x, v) #define chmin(x, v) x = min(x, v) #define pii pair<int, int> #define pb push_back #define sz(x) (int)x.size() #define x first #define y second //#define int long long using namespace std; void init(int T) { /* ... */ } void orderCoins() { int W[6]; for (int i = 0; i < 6; ++i) W[i] = -1; set<int> reste = {1, 2, 3, 4, 5, 6}; for (int i = 0; i < 4; ++i){ /*cout << "tour " << i << endl; for (int a : reste) cout << a << " "; cout << endl; */int mini = *reste.begin(); vector<int> file; for (int a : reste) file.pb(a); reverse(all(file)); file.pop_back(); reverse(all(file)); /* for (int a : file) cout << a << " "; cout << endl << "--------" << endl; */ int pasMini = -1; for (int i = 0; i < sz(file); i += 2){ int avant = mini; if (i + 1 < sz(file)) { // cout << "QUERY " << mini << " " << file[i] << " " << file[i + 1] << endl; mini = getLightest(mini, file[i], file[i + 1]); // cout << "ans" << mini << endl; for (int j : {i, i + 1}){ if (mini != file[j]) pasMini = file[j]; } if (avant != mini) pasMini = avant; } else mini = getLightest(mini, pasMini, file[i]); } // cout << "mini " << mini << endl; reste.erase(mini); W[i] = mini; } int a = *reste.begin(); reste.erase(reste.begin()); int b = *reste.begin(); W[5] = getHeaviest(W[0], a, b); W[4] = a; if (W[5] == W[4]) W[4] = b; /* cout << "W" << endl; for (int i = 0; i < 6; ++i) cout << W[i] << " "; cout << endl;*/ answer(W); return; }

Compilation message (stderr)

scales.cpp: In function 'void init(int)':
scales.cpp:14:15: warning: unused parameter 'T' [-Wunused-parameter]
   14 | void init(int T) {
      |           ~~~~^
scales.cpp: In function 'void orderCoins()':
scales.cpp:39:18: warning: declaration of 'i' shadows a previous local [-Wshadow]
   39 |         for (int i = 0; i < sz(file); i += 2){
      |                  ^
scales.cpp:23:14: note: shadowed declaration is here
   23 |     for (int i = 0; i < 4; ++i){
      |              ^
#Verdict Execution timeMemoryGrader output
Fetching results...