Submission #668829

#TimeUsernameProblemLanguageResultExecution timeMemory
668829AstraytScales (IOI15_scales)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #include "scales.h" using namespace std; #define pb push_back #define ll long long #define pii pair<int,int> #define All(x) x.begin(), x.end() vector<int> adj[6]; int t, deg[6], arr[6]; void init(int T){ t = T; for(int i = 0; i < 6; ++i) deg[i] = 0; } void orderCoins(){ for(int i = 0; i < 6; ++i){ adj[i].clear(); } for(int i = 1; i <= 6; ++i){ for(int j = i + 1; j <= 6; ++j){ for(int k = j + 1; k <= 6; ++k){ int a = getHeaviest(i, j, k), b = getMedium(i, j, k), c; if(a == i && b == j || a == j && b == i) c = k; else if(a == i && b == k || a == k && b == i) c = j; else c = i; adj[a].pb(b), adj[b].pb(c); deg[b]++, deg[c]++; } } } queue<int> bfs; vector<int> top; for(int i = 0; i < 6; ++i){ if(deg[i] == 0) bfs.push(i); } while(bfs.size()){ int u = bfs.front(); bfs.pop(); top.pb(u); for(auto v:adj[u]){ deg[v]--; if(deg[v] == 0) bfs.push(v); } } reverse(top.begin(), top.end()); int ans[6]; for(int i = 0; i < 6; ++i) ans[i] = top[i] + 1; answer(ans); return; }

Compilation message (stderr)

scales.cpp: In function 'void orderCoins()':
scales.cpp:24:42: error: 'getMedium' was not declared in this scope; did you mean 'getMedian'?
   24 |        int a = getHeaviest(i, j, k), b = getMedium(i, j, k), c;
      |                                          ^~~~~~~~~
      |                                          getMedian
scales.cpp:25:18: warning: suggest parentheses around '&&' within '||' [-Wparentheses]
   25 |        if(a == i && b == j || a == j && b == i) c = k;
      |           ~~~~~~~^~~~~~~~~
scales.cpp:25:49: error: 'c' was not declared in this scope
   25 |        if(a == i && b == j || a == j && b == i) c = k;
      |                                                 ^
scales.cpp:26:23: warning: suggest parentheses around '&&' within '||' [-Wparentheses]
   26 |        else if(a == i && b == k || a == k && b == i) c = j;
      |                ~~~~~~~^~~~~~~~~
scales.cpp:26:54: error: 'c' was not declared in this scope
   26 |        else if(a == i && b == k || a == k && b == i) c = j;
      |                                                      ^
scales.cpp:27:13: error: 'c' was not declared in this scope
   27 |        else c = i;
      |             ^
scales.cpp:28:32: error: 'c' was not declared in this scope
   28 |        adj[a].pb(b), adj[b].pb(c);
      |                                ^