Submission #133211

#TimeUsernameProblemLanguageResultExecution timeMemory
133211Mahdi_JfriScales (IOI15_scales)C++14
55.56 / 100
2 ms380 KiB
#include "scales.h" #include<bits/stdc++.h> using namespace std; #define ll long long #define pb push_back #define gh getHeaviest #define gl getLightest #define gm getMedian #define gnl getNextLightest const int maxn = 1e5 + 20; void init(int T) { srand(time(NULL)); } void orderCoins() { int res[] = {85 , 1, 2, 3, 4, 5, 6}; random_shuffle(res + 1 , res + 7); { int a = res[1] , b = res[2] , c = res[3]; int x = gl(a , b , c) , y = gm(a , b , c); res[1] = x , res[2] = y , res[3] = (a + b + c) - x - y; a = res[4] , b = res[5] , c = res[6]; x = gl(a , b , c) , y = gm(a , b , c); res[4] = x , res[5] = y , res[6] = (a + b + c) - x - y; } int w[6]; if(gl(res[1] , res[2] , res[4]) == res[4]) { swap(res[1] , res[4]); swap(res[2] , res[5]); swap(res[3] , res[6]); } int tx = gnl(res[1] , res[4] , res[5] , res[2]); if(tx == res[1]) { w[0] = res[1] , w[1] = res[4] , w[2] = res[5]; w[3] = gl(res[2] , res[3] , res[6]); w[4] = gm(res[2] , res[3] , res[6]); w[5] = res[2] + res[3] + res[6] - w[3] - w[4]; } else if(tx == res[4]) { tx = gnl(res[1] , res[4] , res[5] , res[3]); if(tx == res[1]) { w[0] = res[1] , w[1] = res[2] , w[2] = res[4] , w[3] = res[5]; w[4] = gm(res[1] , res[3] , res[6]); w[5] = res[3] + res[6] - w[4]; } else if(tx == res[4]) { w[0] = res[1] , w[1] = res[2] , w[2] = res[3] , w[3] = res[4] , w[4] = res[5] , w[5] = res[6]; } else { w[0] = res[1] , w[1] = res[2] , w[2] = res[4] , w[3] = res[3] , w[4] = res[5] , w[5] = res[6]; } } else { tx = gnl(res[2] , res[5] , res[6] , res[3]); if(tx == res[2]) w[0] = res[1] , w[1] = res[4] , w[2] = res[2] , w[3] = res[5] , w[4] = res[6] , w[5] = res[3]; else if(tx == res[5]) w[0] = res[1] , w[1] = res[4] , w[2] = res[2] , w[3] = res[3] , w[4] = res[5] , w[5] = res[6]; else w[0] = res[1] , w[1] = res[4] , w[2] = res[2] , w[3] = res[5] , w[4] = res[3] , w[5] = res[6]; } answer(w); }

Compilation message (stderr)

scales.cpp: In function 'void init(int)':
scales.cpp:18:12: warning: conversion to 'unsigned int' from 'time_t {aka long int}' may alter its value [-Wconversion]
  srand(time(NULL));
        ~~~~^~~~~~
scales.cpp:16:15: warning: unused parameter 'T' [-Wunused-parameter]
 void init(int T)
               ^
#Verdict Execution timeMemoryGrader output
Fetching results...