Submission #386680

#TimeUsernameProblemLanguageResultExecution timeMemory
386680KeshiScales (IOI15_scales)C++17
0 / 100
2 ms640 KiB
//In the name of God #include <bits/stdc++.h> #include "scales.h" using namespace std; typedef long long ll; typedef pair<ll, ll> pll; const ll maxn = 2e5 + 100; const ll mod = 1e9 + 7; const ll inf = 1e18; #define fast_io ios::sync_with_stdio(false);cin.tie(0);cout.tie(0); #define file_io freopen("input.txt", "r+", stdin);freopen("output.txt", "w+", stdout); #define pb push_back #define Mp make_pair #define F first #define S second #define Sz(x) ll((x).size()) #define all(x) (x).begin(), (x).end() #define g1 getLightest #define g2 getMedian #define g3 getHeaviest #define g4 getNextLightest void init(int T) { srand(time(NULL)); } int a[] = {1, 2, 3, 4, 5, 6}; int b[] = {1, 2, 3, 4, 5, 6}; void Do(ll i, ll j){ b[i] = a[i]; for(ll o = i; o > j; o--){ swap(b[o], b[o - 1]); } } void orderCoins(){ //random_shuffle(a, a + 6); ll cnt = 3; b[0] = g1(a[0], a[1], a[2]); b[1] = g2(a[0], a[1], a[2]); b[2] = g3(a[0], a[1], a[2]); // solve b[3] cnt++; ll x = g4(b[0], b[1], b[2], a[3]); if(x == b[0]){ cnt++; if(g1(b[0], b[1], a[3]) == a[3]) Do(3, 0); else Do(3, 3); } else{ if(x == b[1]) Do(3, 1); else Do(3, 2); } // solve b[4] x = g4(b[0], b[1], b[2], a[4]); cnt++; if(x != b[0]){ if(x == b[1]) Do(4, 1); else Do(4, 2); } else{ cnt++; x = g4(b[0], b[1], b[3], a[4]); if(x == b[3]) Do(4, 3); else{ cnt++; if(g1(b[0], b[1], a[4]) == a[4]) Do(4, 0); else Do(4, 4); } } // solve b[5] cnt++; x = g4(b[0], b[1], b[2], a[5]); if(x != b[0]){ if(x == b[1]) Do(5, 1); else Do(5, 2); } else{ cnt++; x = g4(b[0], b[3], b[4], a[5]); if(x != b[0]){ if(x == b[3]) Do(5, 3); else Do(5, 4); } else{ cnt++; if(g1(b[0], b[1], a[5]) == a[5]) Do(5, 0); else Do(5, 5); } } if(cnt > 11){ answer(a); return; } if(cnt == 11){ cout << 1 / 0; } answer(b); } /*int main(){ fast_io; return 0; } */

Compilation message (stderr)

scales.cpp: In function 'void init(int)':
scales.cpp:28:15: warning: conversion from 'time_t' {aka 'long int'} to 'unsigned int' may change value [-Wconversion]
   28 |     srand(time(NULL));
      |           ~~~~^~~~~~
scales.cpp:27:15: warning: unused parameter 'T' [-Wunused-parameter]
   27 | void init(int T) {
      |           ~~~~^
scales.cpp: In function 'void orderCoins()':
scales.cpp:101:13: warning: division by zero [-Wdiv-by-zero]
  101 |   cout << 1 / 0;
      |           ~~^~~
#Verdict Execution timeMemoryGrader output
Fetching results...