Submission #424732

#TimeUsernameProblemLanguageResultExecution timeMemory
424732ollelScales (IOI15_scales)C++17
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;

int t;

// int getLightest(vi x) {
//   cout << "lightest:";
//   rep(i,0,3) cout << x[i] << " ";cout<<endl;
//   int ans; cin >> ans; return ans;
// }
// int getNextLightest(vi x) {
//   cout << "next lightest:";
//   rep(i,0,4) cout << x[i] << " ";cout<<endl;
//   int ans; cin >> ans; return ans;
// }
// int getMedian(vi x) {
//   cout << "Median:";
//   rep(i,0,3) cout << x[i] << " ";cout<<endl;
//   int ans; cin >> ans; return ans;
// }

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

// void answer(vi x) {rep(i,0,6) cout << x[i] << " ";}

void orderCoins() {
  vi first(3), second(3);
  first[0] = getLightest(1, 2, 3);
  first[1] = getMedian(1, 2, 3);
  rep(i, 1, 4) if (i != first[0] && i != first[1]) first[2] = i;

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

  vi ordered;
  int fi = 0, si = 0;
  ordered.pb(getLightest(first[0], first[1], second[0]));
  if (ordered[0] == first[0]) fi = 1;//ordered.pb(getLightest({first[1], first[2], second[0]}));
  else si = 1;//ordered.pb(getLightest({first[0], first[1], second[1]}));

  while (ordered.size() < 6) {
    if (si < 3 && fi < 3) {
      if (si != 2) ordered.pb(getLightest(first[fi], second[si], second[si + 1]));
      else if (fi != 2) ordered.pb(getLightest(first[fi], first[fi + 1], second[si]));
      else ordered.pb(getNextLightest(first[0], first[fi], second[si], ordered[ordered.size() - 1]));

      if (ordered[ordered.size() - 1] == first[fi]) fi++;
      else si++;
    }
    else if (si < 3) {
      ordered.pb(second[si]); si++;
    }
    else {
      ordered.pb(first[fi]); fi++;
    }
  }
  int[6] o;
  rep(i,0,6) o[i] = ordered[i];
  answer(o);
}


// int main(){
//   orderCoins();
// }

Compilation message (stderr)

scales.cpp: In function 'void orderCoins()':
scales.cpp:68:7: error: expected identifier before numeric constant
   68 |   int[6] o;
      |       ^
scales.cpp:68:7: error: expected ']' before numeric constant
   68 |   int[6] o;
      |       ^
      |       ]
scales.cpp:68:6: error: structured binding declaration cannot have type 'int'
   68 |   int[6] o;
      |      ^
scales.cpp:68:6: note: type must be cv-qualified 'auto' or reference to cv-qualified 'auto'
scales.cpp:68:6: error: empty structured binding declaration
scales.cpp:68:10: error: expected initializer before 'o'
   68 |   int[6] o;
      |          ^
scales.cpp:69:14: error: 'o' was not declared in this scope
   69 |   rep(i,0,6) o[i] = ordered[i];
      |              ^
scales.cpp:70:10: error: 'o' was not declared in this scope
   70 |   answer(o);
      |          ^
scales.cpp:68:6: warning: unused structured binding declaration [-Wunused-variable]
   68 |   int[6] o;
      |      ^