Submission #1037426

#TimeUsernameProblemLanguageResultExecution timeMemory
1037426mindiyakScales (IOI15_scales)C++14
45.45 / 100
1 ms424 KiB
#include "scales.h" #pragma GCC optimize("O1,O2,O3,Ofast,unroll-loops") #include <bits/stdc++.h> #include <string> #include <iostream> #include <cmath> #include <set> #include <numeric> using namespace std; typedef long long ll; typedef unsigned long long ull; typedef long double ld; typedef pair<int, int> pi; typedef pair<int, int> pl; typedef pair<ld, ld> pd; typedef vector<int> vi; typedef vector<bool> vb; typedef vector<vector<int>> vvi; typedef vector<ld> vd; typedef vector<ll> vl; typedef vector<pi> vpi; typedef vector<pl> vpl; #define FOR(i, a, b) for (int i = a; i < (b); i++) #define F0R(i, a) for (int i = 0; i < (a); i++) #define FORd(i, a, b) for (int i = (b)-1; i >= a; i--) #define F0Rd(i, a) for (int i = (a)-1; i >= 0; i--) #define trav(a, x) for (auto &a : x) #define uid(a, b) uniform_int_distribution<int>(a, b)(rng) #define len(x) (int)(x).size() #define mp make_pair #define pb push_back #define F first #define nl endl #define S second #define lb lower_bound #define ub upper_bound #define aint(x) x.begin(), x.end() #define raint(x) x.rbegin(), x.rend() #define ins insert const int MOD = 1000000007; void init(int T) { /* ... */ } void orderCoins() { int a,b,c,d,e,f; a = getLightest(1,2,3); c = getHeaviest(1,2,3); FOR(i,1,4){ if(i == a || i == c)continue; b = i; } d = getLightest(4,5,6); f = getHeaviest(4,5,6); FOR(i,4,7){ if(i == d || i == f)continue; e = i; } // cout << a << b << c << d << e << f << endl; vi arr(6,0); arr[0] = getLightest(a,b,d); arr[5] = getHeaviest(c,f,b); // cout << 0 << " " << arr[0] << endl; // cout << 5 << " " << arr[5] << endl; vi temp = {-1,b,e}; if(arr[0] == a)temp[0] = d; else temp[0] = a; arr[1] = getLightest(temp[0],temp[1],temp[2]); // cout << 1 << " " << arr[1] << endl; temp = {-1,b,e}; if(arr[5] == c)temp[0] = f; else temp[0] = c; arr[4] = getHeaviest(temp[0],temp[1],temp[2]); // cout << 4 << " " << arr[4] << endl; temp = vi(); set<int> arr2; vi arr3; for(int j:arr){ arr2.insert(j); } FOR(i,1,7){ if(arr2.count(i) == 0)arr3.pb(i); } arr[2] = getLightest(arr3[0],arr3[1],arr[5]); if(arr[2] == arr3[0])arr[3] = arr3[1]; else arr[3] = arr3[0]; // cout << 2 << " " << arr[2] << endl; // cout << 3 << " " << arr[3] << endl; int arr4[6]; FOR(i,0,6)arr4[i] = arr[i]; answer(arr4); }

Compilation message (stderr)

scales.cpp: In function 'void init(int)':
scales.cpp:42:15: warning: unused parameter 'T' [-Wunused-parameter]
   42 | void init(int T) {
      |           ~~~~^
scales.cpp: In function 'void orderCoins()':
scales.cpp:81:25: warning: 'e' may be used uninitialized in this function [-Wmaybe-uninitialized]
   81 |     arr[4] = getHeaviest(temp[0],temp[1],temp[2]);
      |              ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
scales.cpp:47:11: warning: 'b' may be used uninitialized in this function [-Wmaybe-uninitialized]
   47 |     int a,b,c,d,e,f;
      |           ^
#Verdict Execution timeMemoryGrader output
Fetching results...