Submission #424951

#TimeUsernameProblemLanguageResultExecution timeMemory
424951ollelScales (IOI15_scales)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h>
#include <iostream>
#include "scales.h"
using namespace std;

#define rep(i,a,b) for(int i = a; i < b; i++)
#define pb push_back
#define lso(x) x&(-x)

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;

void init(int T) {t = T;}

void orderCoins() {

  vi a(3), b(3);
  a[0] = getLightest(1, 2, 3);
  a[1] = getMedian(1, 2, 3);
  rep(i, 1, 4) if (i != a[0] && i != a[1]) a[2] = i;

  b[0] = getLightest(4, 5, 6);
  b[1] = getMedian(4, 5, 6);
  rep(i, 4, 7) if (i != b[0] && i != b[1]) b[2] = i;


  vi o = {getMin(a[0], a[1], b[0])};
  if (o[0] == a[0]) swap(a, b);

  // a has 3, b has 2
  o.pb(getMin(a[0], b[1], a[1]));
  if (o[1] == a[0]) {
    // a 2, b 2

    int mini = getMin(a[1], a[2], b[1]);
    if (mini == b[1]) swap(a, b);

    // a[1] < b[1]
    o.pb(a[1]);
    int x = getMedian(a[2], b[1], b[2]);
    if (x == a[2]) {
      o.pb(b[1]);
      o.pb(a[2]);
      o.pb(b[2]);
    } else if (x == b[1]) {
      o.pb(a[2]);
      o.pb(b[1]);
      o.pb(b[2]);
    } else {
      o.pb(b[1]);
      o.pb(b[2]);
      o.pb(a[2]);
    }

  } else {
    // a 3, b 1
    int x = getNextLightest(a[0], a[1], a[2], b[2]);
    if (x == a[1]) {
      o.pb(a[0]);
      o.pb(b[2]);
      o.pb(a[1]);
      o.pb(a[2]);
    } else if (x == a[2]) {
      o.pb(a[0]);
      o.pb(a[1]);
      o.pb(b[2]);
      o.pb(a[2]);
    } else {
      int mini = getMin(a[2], a[1], b[2]);
      if (mini == b[2]) {
        o.pb(b[2]);
        o.pb(a[0]);
        o.pb(a[1]);
        o.pb(a[2]);
      } else {
        o.pb(a[0]);
        o.pb(a[1]);
        o.pb(a[2]);
        o.pb(b[2]);
      }
    }
  }
  int aaa[6];
  rep(i,0,6) aaa[i] = o[i];
  answer(aaa);
}

Compilation message (stderr)

scales.cpp: In function 'void init(int)':
scales.cpp:14:19: error: 't' was not declared in this scope
   14 | void init(int T) {t = T;}
      |                   ^
scales.cpp: In function 'void orderCoins()':
scales.cpp:28:11: error: 'getMin' was not declared in this scope; did you mean 'getline'?
   28 |   vi o = {getMin(a[0], a[1], b[0])};
      |           ^~~~~~
      |           getline
scales.cpp:28:35: error: could not convert '{<expression error>}' from '<brace-enclosed initializer list>' to 'vi' {aka 'std::vector<int>'}
   28 |   vi o = {getMin(a[0], a[1], b[0])};
      |                                   ^
      |                                   |
      |                                   <brace-enclosed initializer list>