Submission #767129

#TimeUsernameProblemLanguageResultExecution timeMemory
767129caganyanmazScales (IOI15_scales)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #define pb push_back #include "scales.h" using namespace std; #ifdef DEBUGGING #define debug(x) cout << #x << ": " << x << "\n"; #else #define debug(x) 42 #endif void init(int T) {} array<int, 3> find_other_values(int a, int b, int c) { int a1 = 6 - a - c; int b2 = 4; while (b2 == b) b2++; int b3 = 4; while (b3 == b || b3 == b2) b3++; return array<int,3>({a1, b2, b3}); } void orderCoins() { vector<int> v(3); int a = getLightest(1, 2, 3); int b = getLightest(4, 5, 6); int c = 1; while (c == a) c++; auto [a1, b2, b3] = find_other_values(a, b, c); int m = getMedian(a, b, c); debug(a); debug(b); debug(c); debug(m); if (m == a) { v[0] = b, v[1] = a, v[2] = c; int bb2 = getNextLightest(b, a, c, b2); debug(bb2); if (bb2 == b || bb2 == c) { int aa1 = getNextLightest(a, b2, c, a1); int bpos = -1, cpos = 2; if (bb2 == b) { bpos = v.size(); v.pb(b2); } else // bb2 == c { bpos = 2; v.insert(v.begin() + 2, b2); cpos = 3; } if (aa1 == a) v.pb(a1); else if (aa1 == b2) v.insert(v.begin() + bpos, a1); else // aa1 == c v.insert(v.begin() + cpos, a1); int bb3 = getNextLightest(v[0], v[1], v[2], b3); if (bb3 == v[1]) v.insert(v.begin() + 1, b3); else if (bb3 == v[2]) v.insert(v.begin() + 2, b3); else // This is where we get fucked (7th search possibility) { bb3 = getNextLightest(v[2], v[3], v[4], b3); if (bb3 == v[2]) v.pb(b3); else if (bb3 == v[3]) v.insert(v.begin() + 3, b3); else // bb3 == v[4] v.insert(v.begin() + 4, b3); } } else // bb2 == a { debug("hi"); v.insert(v.begin() + 1, b2); int mx = getHeaviest(a1, c, b3); if (mx == a1) { int bb3 = getNextLightest(v[0], v[1], v[2], b3); if (bb3 == v[1]) v.insert(v.begin() + 1, b3); else if (bb3 == v[2]) v.insert(v.begin() + 2, b3); else v.insert(v.begin() + 3, b3); v.pb(a1); } else if (mx == b3) { int mn = getLightest(a1, c, b3); if (mn == a1) v.insert(v.begin() + 3, a); else v.pb(a1); v.pb(b3); } else // mx == c { int bb3 = getNextLightest(v[0], v[1], v[2], b3); if (bb3 == v[1]) v.insert(v.begin() + 1, b3); else if (bb3 == v[2]) v.insert(v.begin() + 2, b3); else // Yet another fuck point { int mx2 = getHeaviest(v[0], b3, a1); if (mx2 == b3) { v.insert(v.begin() + 3, b3); v.insert(v.begin() + 3, a1); } else { v.insert(v.begin() + 3, a1); v.insert(v.begin() + 3, b3); } } } } } if (m == b) { debug(a1); v[0] = a, v[1] = b, v[2] = c; int aa1 = getNextLightest(v[0], v[1], v[2], a1); if (aa1 == v[1]) { v.insert(v.begin() + 1, a1); int mx = getHeaviest(b, c, b2); if (mx == b2) v.pb(b2); else // mx == c v.insert(v.begin() + 2, b2); int bb3 = getNextLightest(v[2], v[3], v[4], b3); if (bb3 == v[2]) v.pb(b3); if (bb3 == v[3]) v.insert(v.begin() + 3, b3); else v.insert(v.begin() + 4, b3); } else // aa1 == v[0] || aa1 == v[2] { debug("oi"); if (aa1 == v[0]) v.pb(a1); else v.insert(v.begin() + 2, a1); debug(b2); debug(b3); int bb2 = getNextLightest(v[1], v[2], v[3], b2); if (bb2 == v[1]) v.pb(b2); else if (bb2 == v[2]) v.insert(v.begin() + 2, b2); else v.insert(v.begin() + 3, b2); int bb3 = getNextLightest(v[1], v[2], v[3], b3); if (bb3 == v[2]) { v.insert(v.begin() + 2, b3); } else if (bb3 == v[3]) { v.insert(v.begin() + 3, b3); } else // One last fuck-point { debug("haii"); bb3 = getNextLightest(v[2], v[3], v[4], b3); if (bb3 == v[3]) { debug(a, b, c, a1, b2, b3); } assert(bb3 == v[3]); if (bb3 == v[2]) v.pb(b3); else // bb3 == v[4] v.insert(v.begin() + 4, b3); } } } if (m == c) { v[0] = a, v[1] = c, v[2] = b; int aa1 = getNextLightest(v[0], v[1], v[2], a1); if (aa1 == v[0]) v.pb(a1); else if (aa1 == v[1]) v.insert(v.begin() + 1, a1); else v.insert(v.begin() + 2, a1); int bb2 = getNextLightest(v[1], v[2], v[3], b2); if (bb2 == v[1]) v.pb(b2); else if (bb2 == v[2]) v.insert(v.begin() + 2, b2); else v.insert(v.begin() + 3, b2); int bb3 = getNextLightest(v[2], v[3], v[4], b3); if (bb3 == v[2]) v.pb(b3); else if (bb3 == v[3]) v.insert(v.begin() + 3, b3); else v.insert(v.begin() + 4, b3); } int result[6]; for (int i =0; i< 6; i++) result[i] = v[i]; answer(result); }

Compilation message (stderr)

scales.cpp:180:66: error: macro "debug" passed 6 arguments, but takes just 1
  180 |                                         debug(a, b, c, a1, b2, b3);
      |                                                                  ^
scales.cpp:8: note: macro "debug" defined here
    8 | #define debug(x) 42
      | 
scales.cpp: In function 'void init(int)':
scales.cpp:11:15: warning: unused parameter 'T' [-Wunused-parameter]
   11 | void init(int T)
      |           ~~~~^
scales.cpp: In function 'void orderCoins()':
scales.cpp:8:18: warning: statement has no effect [-Wunused-value]
    8 | #define debug(x) 42
      |                  ^~
scales.cpp:33:9: note: in expansion of macro 'debug'
   33 |         debug(a);
      |         ^~~~~
scales.cpp:8:18: warning: statement has no effect [-Wunused-value]
    8 | #define debug(x) 42
      |                  ^~
scales.cpp:34:9: note: in expansion of macro 'debug'
   34 |         debug(b);
      |         ^~~~~
scales.cpp:8:18: warning: statement has no effect [-Wunused-value]
    8 | #define debug(x) 42
      |                  ^~
scales.cpp:35:9: note: in expansion of macro 'debug'
   35 |         debug(c);
      |         ^~~~~
scales.cpp:8:18: warning: statement has no effect [-Wunused-value]
    8 | #define debug(x) 42
      |                  ^~
scales.cpp:36:9: note: in expansion of macro 'debug'
   36 |         debug(m);
      |         ^~~~~
scales.cpp:8:18: warning: statement has no effect [-Wunused-value]
    8 | #define debug(x) 42
      |                  ^~
scales.cpp:41:17: note: in expansion of macro 'debug'
   41 |                 debug(bb2);
      |                 ^~~~~
scales.cpp:48:46: warning: conversion from 'std::vector<int>::size_type' {aka 'long unsigned int'} to 'int' may change value [-Wconversion]
   48 |                                 bpos = v.size();
      |                                        ~~~~~~^~
scales.cpp:8:18: warning: statement has no effect [-Wunused-value]
    8 | #define debug(x) 42
      |                  ^~
scales.cpp:81:25: note: in expansion of macro 'debug'
   81 |                         debug("hi");
      |                         ^~~~~
scales.cpp:8:18: warning: statement has no effect [-Wunused-value]
    8 | #define debug(x) 42
      |                  ^~
scales.cpp:130:17: note: in expansion of macro 'debug'
  130 |                 debug(a1);
      |                 ^~~~~
scales.cpp:8:18: warning: statement has no effect [-Wunused-value]
    8 | #define debug(x) 42
      |                  ^~
scales.cpp:151:25: note: in expansion of macro 'debug'
  151 |                         debug("oi");
      |                         ^~~~~
scales.cpp:8:18: warning: statement has no effect [-Wunused-value]
    8 | #define debug(x) 42
      |                  ^~
scales.cpp:156:25: note: in expansion of macro 'debug'
  156 |                         debug(b2);
      |                         ^~~~~
scales.cpp:8:18: warning: statement has no effect [-Wunused-value]
    8 | #define debug(x) 42
      |                  ^~
scales.cpp:157:25: note: in expansion of macro 'debug'
  157 |                         debug(b3);
      |                         ^~~~~
scales.cpp:8:18: warning: statement has no effect [-Wunused-value]
    8 | #define debug(x) 42
      |                  ^~
scales.cpp:176:33: note: in expansion of macro 'debug'
  176 |                                 debug("haii");
      |                                 ^~~~~
scales.cpp:180:41: error: 'debug' was not declared in this scope
  180 |                                         debug(a, b, c, a1, b2, b3);
      |                                         ^~~~~