Submission #1015486

#TimeUsernameProblemLanguageResultExecution timeMemory
1015486amine_arouaScales (IOI15_scales)C++17
0 / 100
1 ms348 KiB
#include<bits/stdc++.h> #include "scales.h" //#include "graderlib.cpp" using namespace std; void init(int T) { } void sort(vector<int> &a) { vector<int> nw = {-1 , -1 , -1}; nw[0] = getLightest(a[0] , a[1] , a[2]); nw[2] = getHeaviest(a[0] , a[1] , a[2]); for(auto x : a) { if(std::find(nw.begin(), nw.end(),x) == nw.end()) { nw[1] = x; } } a = nw; } mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); void orderCoins() { /* ... */ vector<int> a ,b; vector<int> all ; for(int i = 1 ; i <= 6 ; i++) all.push_back(i); shuffle(all.begin() , all.end() , rng); for(int i = 0 ; i < 6 ; i++) { if(i < 3) a.push_back(all[i]); else b.push_back(all[i]); } sort(a); sort(b); vector<int> d = b; int c[6]; for(int j = 0 ; j < 3 ; j++) { int nxt = getNextLightest(b[0] , b[1] , b[2] , a[j]); d.insert(find(d.begin() , d.end() , nxt) , a[j]); } vector<int> pos; for(int i = 0 ; i < 6 ; i++) { if(find(a.begin() , a.end() , d[i]) == a.end()) continue; pos.push_back((int)(find(a.begin() , a.end() , d[i]) - a.begin())); } for(int i = 0 ; i < 2 ; i++) { if(pos[i] > pos[i + 1]) { vector<int> new_d; for(int j = 0 ; j < 6 ; j++) { bool acc = 1; for(int k = i ; k >= 0 ; k--) { if(d[j] == a[pos[k]]) { acc = 0; break; } } if(acc) new_d.push_back(d[j]); } for(int k = 0 ; k <= i ; k++) new_d.push_back(a[pos[k]]); d = new_d; break; } } if(getHeaviest(a[0] , b[1] , b[2]) == a[0]) { for(int i = 0 ; i < 6 ; i++) { if(i < 3) c[i] = b[i]; else c[i] = a[i - 3]; } answer(c); return ; } for(int i = 0 ; i < 6 ; i++) c[i] = d[i]; answer(c); } /* int main() { int T, i; T = _getNumberOfTests(); init(T); for (i = 1; i <= T; i++) { _initNewTest(); orderCoins(); } return 0; }*/

Compilation message (stderr)

scales.cpp: In function 'void init(int)':
scales.cpp:6:15: warning: unused parameter 'T' [-Wunused-parameter]
    6 | void init(int T) {
      |           ~~~~^
#Verdict Execution timeMemoryGrader output
Fetching results...