Submission #295642

#TimeUsernameProblemLanguageResultExecution timeMemory
295642peti1234Scales (IOI15_scales)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #include "scales.h" using namespace std; const int cc=722, f=6; vector<int> sz; int ert[cc][f], inv[cc][f], pos, db, ki, t[3], re[f], q; bool v[cc]; /* int getLightest(int a, int b, int c) { cout << "kerdes " << a << " " << b << " " << c << " " << 0 << "\n"; int x; cin >> x; return x; } int getMedian(int a, int b, int c) { cout << "kerdes " << a << " " << b << " " << c << " " << 1 << "\n"; int x; cin >> x; return x; } int getHeaviest(int a, int b, int c) { cout << "kerdes " << a << " " << b << " " << c << " " << 2 << "\n"; int x; cin >> x; return x; } void answer(int w[]) { cout << "valasz\n"; for (int i=0; i<f; i++) cout << w[i] << " "; cout << "\n"; } */ int ask(int a, int b, int c, int h) { int x=0, y=0, z=0; for (int i=0; i<pos; i++) if (v[i]) { t[0]=inv[i][a], t[1]=inv[i][b], t[2]=inv[i][c]; //cout << i << " " << t[0] << " " << t[1] << " " << t[2] << endl; //cout << ert[i][0] << endl; sort(t, t+3), q=ert[i][t[h]]; if (a==q) x++; if (b==q) y++; if (c==q) z++; } return max({x, y, z}); } void add(int a, int b, int c, int h, int ans) { for (int i=0; i<pos; i++) if (v[i]) { t[0]=inv[i][a], t[1]=inv[i][b], t[2]=inv[i][c]; sort(t, t+3); if (ert[i][t[h]]!=ans) v[i]=0, db--; } } void orderCoins() { aswer(ert[0]); return; db=0, ki=0; for (int i=0; i<pos; i++) v[i]=1, db++; while(db>1) { int a=1, b=1, c=1, h=0, mini=db, ans=0; for (int x=0; x<f; x++) for (int y=x+1; y<f; y++) for (int z=y+1; z<f; z++) for (int e=0; e<3; e++) { int p=ask(x, y, z, e); if (p<mini) mini=p, a=x, b=y, c=z, h=e; } //cout << "cel " << db << " " << mini << endl; if (h==0) ans=getLightest(a, b, c); if (h==1) ans=getMedian(a, b, c); if (h==2) ans=getHeaviest(a, b, c); add(a, b, c, h, ans); } for (int i=0; i<pos; i++) if (v[i]) ki=i; answer(ert[ki]); } void init(int w) { for (int i=0; i<f; i++) sz.push_back(i); do { for (int i=0; i<f; i++) inv[pos][i]=sz[i], ert[pos][sz[i]]=i; pos++; } while(next_permutation(sz.begin(), sz.end())); }

Compilation message (stderr)

scales.cpp: In function 'void orderCoins()':
scales.cpp:51:5: error: 'aswer' was not declared in this scope; did you mean 'answer'?
   51 |     aswer(ert[0]);
      |     ^~~~~
      |     answer
scales.cpp: In function 'void init(int)':
scales.cpp:70:15: warning: unused parameter 'w' [-Wunused-parameter]
   70 | void init(int w) {
      |           ~~~~^