Submission #411912

#TimeUsernameProblemLanguageResultExecution timeMemory
411912losmi247Scales (IOI15_scales)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; const int N = 7; /*int *p; int gde[N]; void answer(int *sta){ for(int i = 0; i < 6; i++){ if(sta[i] != p[i]){ cout << "WA" << endl; exit(0); } } cout << "OK" << endl; } int getHeaviest(int a,int b,int c){ vector <int> v = {gde[a],gde[b],gde[c]}; sort(v.begin(),v.end()); return p[v[2]]; } int getLightest(int a,int b,int c){ vector <int> v = {gde[a],gde[b],gde[c]}; sort(v.begin(),v.end()); return p[v[0]]; } int getMedian(int a,int b,int c){ vector <int> v = {gde[a],gde[b],gde[c]}; sort(v.begin(),v.end()); return p[v[1]]; } int getNextLightest(int a,int b,int c,int d){ }*/ int t; int n = 6; void init(int T){ t = T; } vector <int> jedanpojedan(){ vector <int> v; for(int i = 1; i <= n; i++) v.push_back(i); vector <int> odg; while(v.size() > 3){ for(int i = 0; i < v.size(); i++){ int drugi = -1,pos = 0; for(int j = 0; j < v.size(); j++){ if(j == i) continue; drugi = v[j]; pos = j; } bool jestenajmanji = 1; for(int j = 0; j < v.size(); j++){ if(j == i || j == pos) continue; int daj = getLightest(v[i],drugi,v[j]); if(daj != v[i]){ jestenajmanji = 0; break; } } if(jestenajmanji){ odg.push_back(v[i]); vector <int> cuv; while(v.back() != v[i]){ cuv.push_back(v.back()); v.pop_back(); } v.pop_back(); reverse(cuv.begin(),cuv.end()); for(auto f : cuv){ v.push_back(f); } break; } } } int najm = getLightest(v[0],v[1],v[2]), sred = getMedian(v[0],v[1],v[2]), najv = getHeaviest(v[0],v[1],v[2]); odg.push_back(najm); odg.push_back(sred); odg.push_back(najv); return odg; } void orderCoins(){ vector <int> v = jedanpojedan(); int *ans = (int*)malloc(sizeof(int)*6); for(int i = 0; i < 6; i++) ans[i] = v[i]; answer(ans); } /*int main(){ ios_base::sync_with_stdio(false); cin.tie(0); int tc; cin >> tc; init(tc); for(int i = 1; i <= tc; i++){ p = (int*)malloc(sizeof(int)*6); for(int j = 0; j < 6; j++){ cin >> p[j]; gde[p[j]] = j; } orderCoins(); } }*/

Compilation message (stderr)

scales.cpp: In function 'std::vector<int> jedanpojedan()':
scales.cpp:59:26: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   59 |         for(int i = 0; i < v.size(); i++){
      |                        ~~^~~~~~~~~~
scales.cpp:61:30: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   61 |             for(int j = 0; j < v.size(); j++){
      |                            ~~^~~~~~~~~~
scales.cpp:67:30: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   67 |             for(int j = 0; j < v.size(); j++){
      |                            ~~^~~~~~~~~~
scales.cpp:69:27: error: 'getLightest' was not declared in this scope
   69 |                 int daj = getLightest(v[i],drugi,v[j]);
      |                           ^~~~~~~~~~~
scales.cpp:92:16: error: 'getLightest' was not declared in this scope
   92 |     int najm = getLightest(v[0],v[1],v[2]), sred = getMedian(v[0],v[1],v[2]), najv = getHeaviest(v[0],v[1],v[2]);
      |                ^~~~~~~~~~~
scales.cpp:95:19: error: 'sred' was not declared in this scope
   95 |     odg.push_back(sred);
      |                   ^~~~
scales.cpp:96:19: error: 'najv' was not declared in this scope; did you mean 'najm'?
   96 |     odg.push_back(najv);
      |                   ^~~~
      |                   najm
scales.cpp: In function 'void orderCoins()':
scales.cpp:105:5: error: 'answer' was not declared in this scope
  105 |     answer(ans);
      |     ^~~~~~