Submission #1017845

#TimeUsernameProblemLanguageResultExecution timeMemory
1017845amirhoseinfar1385Scales (IOI15_scales)C++17
Compilation error
0 ms0 KiB
#include "scales.h"
#include<bits/stdc++.h>
using namespace std;
vector<int>ret;
 
void init(int T) {
    /* ... */
    ret.resize(7);
}
 
void jab(int u,int ind){
    for(int i=1;i<=6;i++){
        if(ret[i]==u){
            swap(ret[i],ret[ind]);
            return ;
        }
    }
}
 
void ghabl(int u,int v){
    vector<int>fake;
    fake.push_back(0);
    for(int i=1;i<=6;i++){
        if(ret[i]==u){
            continue;
        }
        if(ret[i]==v){
            fake.push_back(u);
        }
        fake.push_back(ret[i]);
    }
    ret=fake;
}
int res[] = {1, 2, 3, 4, 5, 6};

void pors(){
    for(int i=0;i<6;i++){
        res[i]=ret[i+1];
    }
}

void orderCoins() {
    /* ... */
    for(int i=1;i<=6;i++){
        ret[i]=i;
    }
    int h1=getHeaviest(1,2,3);
    int l1=getLightest(1,2,3);
    int h2=getHeaviest(4,5,6);
    int l2=getLightest(4,5,6);
    jab(h1,3);
    jab(l1,1);
    jab(h2,6);
    jab(l2,4);
    int m1=getMedian(ret[1],ret[2],ret[4]),m2=getmedian(ret[3],ret[5],ret[6]);
    if(m1==ret[2]&&m2==ret[5]){
        if(getHeaviest(ret[3],ret[4],ret[2])==ret[3]){
            swap(ret[3],ret[4]);
            por();
            aswer(res);
            return ;     
        }else{
            por();
            answer(res);
            return ;
        }
    }
    int r=6;
    while(r>=4&&getHeaviest(h1,l1,ret[r])==ret[r]){
        r--;
    }
    for(int i=4;i<=r;i++){
        int z=getNextLightest(1,2,3,ret[i]);
        ghabl(ret[i],z);
    }
    for(int i=0;i<6;i++){
        res[i]=ret[i+1];
    }
    answer(res);
}

Compilation message (stderr)

scales.cpp: In function 'void init(int)':
scales.cpp:6:15: warning: unused parameter 'T' [-Wunused-parameter]
    6 | void init(int T) {
      |           ~~~~^
scales.cpp: In function 'void orderCoins()':
scales.cpp:55:47: error: 'getmedian' was not declared in this scope; did you mean 'getMedian'?
   55 |     int m1=getMedian(ret[1],ret[2],ret[4]),m2=getmedian(ret[3],ret[5],ret[6]);
      |                                               ^~~~~~~~~
      |                                               getMedian
scales.cpp:59:13: error: 'por' was not declared in this scope; did you mean 'pors'?
   59 |             por();
      |             ^~~
      |             pors
scales.cpp:60:13: error: 'aswer' was not declared in this scope; did you mean 'answer'?
   60 |             aswer(res);
      |             ^~~~~
      |             answer
scales.cpp:63:13: error: 'por' was not declared in this scope; did you mean 'pors'?
   63 |             por();
      |             ^~~
      |             pors