Submission #485447

#TimeUsernameProblemLanguageResultExecution timeMemory
485447MohamedAliSaidaneScales (IOI15_scales)C++14
0 / 100
1 ms204 KiB
#include <bits/stdc++.h> #include "scales.h" using namespace std; typedef pair<int,int> pii; typedef vector<int> vi; typedef long long ll; typedef pair<ll,ll> pll; typedef tuple<int,int,int> ti; typedef unsigned long long ull; typedef long double ld; typedef vector<ll> vll; typedef pair<ld,ld> pld; #define pb push_back #define popb pop_back() #define pf push_front #define popf pop_front #define ff first #define ss second #define MOD (ll)(1000000007) #define INF (ll) (1e18) #define all(v) (v).begin(),(v).end() const int nx[8] = {0, 0, 1, -1,1,1,-1,-1}, ny[8] = {1, -1, 0, 0,1,-1,1,-1}; //East, West, South, North+ ll gcd(ll a , ll b) {return b ? gcd(b , a % b) : a ;} ll lcm(ll a, ll b){return (a / gcd(a, b)) * b;} ////////////******SOLUTION******\\\\\\\\\\\ int light(int A, int B, int C) { return getLightest(A, B, C); } int heav(int A, int B, int C) { return getHeaviest(A,B,C); } int med(int A, int B, int C) { return getMedian(A,B,C); } int nxt(int A, int B, int C, int D) { return getNextLightest(A,B,C,D); } void orderCoins() { int W[6]; int adj[7][7]; memset(adj,0,sizeof(adj)); int X = light(1,2,3); int U = heav(1,2,3); int M; for(int i = 1; i <= 3; i++) if(X != i && U != i) M = i; int Y = light(4,5,6); int V = heav(4,5,6); int N; for(int i= 4; i <= 6; i ++) if(Y != i && V != i) N = i; int anx = med(M,N,V); if(anx == N) { swap(X,Y); swap(M,N); swap(U,V); anx = med(X,Y,N); W[0] = anx == Y? X: Y; W[1] = anx; W[2] = anx == X? N: X; anx = med(M,U,V); W[3] = anx == M? V: M; W[4] = anx; W[5] = anx == V? U: V; answer(W); return ; } else if(anx == M) { // Y < N < M < V anx = med(X,Y,N); W[0] = anx == Y? X: Y; W[1] = anx; W[2] = anx == X? N: X; anx = med(M,U,V); W[3] = anx == M? V: M; W[4] = anx; W[5] = anx == V? U: V; answer(W); return ; } else { // N < V < M < U anx = med(X,Y,N); int five = M; int six = U; int one, two, three, four; if(anx == X) { // Y < X < N < V < M < U one = Y; two = X; three = N, four = V; } else if(anx == Y) { // X < Y < N < V < M < U one = X, two = Y, three = N, four = V; } else { // Y < N < X, V < M < U one = Y, two = N; three = light(X,V,U); four = three == X? V: X; } W[0] = one, W[1] = two, W[2] = three, W[3] = four; W[4] = five; W[5] = six; answer(W); return ; } } void init(int T) { return ; } /*int main() { ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); solve(); }*/

Compilation message (stderr)

scales.cpp:25:1: warning: multi-line comment [-Wcomment]
   25 | ////////////******SOLUTION******\\\\\\\\\\\
      | ^
scales.cpp: In function 'void init(int)':
scales.cpp:123:15: warning: unused parameter 'T' [-Wunused-parameter]
  123 | void init(int T)
      |           ~~~~^
scales.cpp: In function 'void orderCoins()':
scales.cpp:72:24: warning: 'N' may be used uninitialized in this function [-Wmaybe-uninitialized]
   72 |         W[3] = anx == M? V: M;
      |                ~~~~~~~~^~~~~~
scales.cpp:37:21: warning: 'M' may be used uninitialized in this function [-Wmaybe-uninitialized]
   37 |     return getMedian(A,B,C);
      |            ~~~~~~~~~^~~~~~~
scales.cpp:51:9: note: 'M' was declared here
   51 |     int M;
      |         ^
#Verdict Execution timeMemoryGrader output
Fetching results...