제출 #289437

#제출 시각아이디문제언어결과실행 시간메모리
289437user202729저울 (IOI15_scales)C++17
0 / 100
2 ms512 KiB
#include "scales.h" #include<bits/stdc++.h> using P=std::array<unsigned char, 6>;using M=std::bitset<720>;struct Query{ int type;std::array<unsigned char, 4> parameter;int operator()(P it) const{ std::array<std::pair<unsigned char, unsigned char>, 3> pairs;for(int index=0; index<3; ++index) pairs[index]={it[parameter[index]], index};std::sort(begin(pairs), end(pairs),[&](auto first, auto sec){return first.first<sec.first;});if(type==3){ auto const cut=it[parameter[3]];for(auto [value, index]: pairs) if(value>cut) return index;return pairs[0].second;} return pairs[type].second;} int get(){ auto const process=[&](auto function){ auto const result=function(parameter[0]+1, parameter[1]+1, parameter[2]+1)-1;for(int index=0;; ++index){ assert(index<3);if(result==parameter[index]) return index;} };auto const process4=[&](auto function){ auto const result=function(parameter[0]+1, parameter[1]+1, parameter[2]+1, parameter[3]+1)-1;for(int index=0;; ++index){ assert(index<3);if(result==parameter[index]) return index;} };switch(type){ case 0: return process(getLightest);case 1: return process(getMedian);case 2: return process(getHeaviest);case 3: return process4(getNextLightest);default: assert(false); __builtin_unreachable();} } };int const numLayer=6;std::mt19937 engine;std::array<P, 720> permutations_;std::array<int, numLayer+1> pow3;std::vector<int> layerOf;std::vector<M> masks;std::vector<Query> bestQuery;void init(int T) { { P it; std::iota(begin(it), end(it), 0);int index=0;do{ permutations_[index++]=it;}while(std::next_permutation(begin(it), end(it)));} auto const get=[&](int index)->P{return permutations_[index];};for(int index=0, value=1; index<(int)pow3.size(); ++index, value*=3) pow3[index]=value;for(int layer=numLayer; layer>=0; --layer) layerOf.insert(layerOf.end(), pow3[numLayer-layer], layer);masks.resize(layerOf.size());bestQuery.resize(layerOf.size());masks[0]=~ M{};bestQuery={{{1,{4,2}},{3,{5,3,1}},{0,{5,3,1}},{3,{5,3,1}},{2,{4,3,1}},{3,{5,4,1,2}},{3,{5,4,3,2}},{3,{0,3,1,4}},{3,{0,4,1,5}},{3,{0,4,3,5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{3,{5,2,1}},{3,{5,0,1,3}},{1,{4,2,1}},{3,{5,1,2,4}},{1,{4,2,1}},{3,{0,3,1,4}},{3,{0,3,1,4}},{3,{1,4,2,5}},{3,{5,0,3,4}},{3,{5,3,0,2}},{3,{4,3,1,2}},{1,{4,3}},{3,{0,2,1,3}},{1,{5,4,3}},{1,{5,4,3}},{3,{5,1,3,4}},{1,{5,4,2}},{1,{5,2,1}},{1,{5,2,1}},{0,{5,1}},{1,{4,1}},{3,{4,2,0,1}},{1,{5,2,1}},{1,{2,1}},{1,{5,2,1}},{3,{5,4,1,2}},{1,{3,2,1}},{1,{3,2,1}},{3,{5,3,0,2}},{1,{5,2}},{3,{5,4,2,1}},{1,{5,2,1}},{1,{5,2,1}},{3,{4,3,1,2}},{3,{3,0,1,2}},{3,{4,0,2,3}},{3,{4,3,0,2}},{1,{2,1}},{2,{3,2,1}},{3,{4,3,1,2}},{3,{4,3,1,2}},{1,{3,2}},{1,{3,2,1}},{1,{3,2}},{2,{5,3,2}},{1,{5,2,1}},{1,{5,3,2}},{0,{5,4}},{3,{4,3,0,2}},{1,{5,4,3}},{1,{4,3,1}},{3,{5,4,2,3}},{1,{5,4,3}},{2,{5,4,3}},{1,{5,4,2}},{2,{4,3,2}},{1,{5,3,1}},{3,{0,3,2,4}},{1,{4,3,2}},{0,{5,3}},{0,{5,3}},{3,{5,0,1,4}},{1,{3,2}},{1,{4,3}},{0,{3,2}},{1,{5,3}},{1,{3,1}},{1,{2,1}},{1,{3,1}},{1,{3,2}},{3,{4,0,1,2}},{1,{5,2,1}},{1,{5,2,1}},{1,{2,1}},{1,{4,2,1}},{3,{5,3,1,2}},{1,{5,4,2}},{3,{5,4,1,2}},{1,{5,3,2}},{3,{1,4,2,5}},{1,{5,4,1}},{3,{5,0,1,4}},{3,{5,1,2,4}},{2,{5,4}},{2,{4,2,1}},{3,{5,1,2,4}},{1,{5,4,1}},{1,{5,4,1}},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},}};auto const process=[&]{ for(int index=0; index*3+3<(int)masks.size(); ++index){ Query best;int bestValue=INT_MAX;int numFound=1;auto const process=[&](Query query){ std::array<M, 3> split{};for(auto index2=masks[index]._Find_first(); index2<masks[index].size();index2=masks[index]._Find_next(index2)){ split[query(get((int)index2))][index2]=true;} int curValue{};for(auto it: split) curValue=std::max(curValue, (int)it.count());if(curValue<bestValue){ bestValue=curValue; best=query; numFound=1; } else if(curValue==bestValue){ if(std::uniform_int_distribution(0, numFound++)(engine)==0) best=query;} return split;};process(bestQuery[index]);assert(bestValue!=INT_MAX);if(bestValue>pow3[layerOf[index]-1]){ assert(false);return false;} auto const tmp=process(best);bestQuery[index]=best;for(int i=0; i<3; ++i) masks[index*3+i+1]=std::move(tmp[i]);} return true;};while(not process()){} for(auto it: bestQuery){ std::cout<<it.type<<' ';for(auto it: it.parameter) std::cout<<it<<' ';std::cout<<'\n';} } void orderCoins() { int node=0;while(masks[node].count()!=1) node=node*3+1+bestQuery[node].get();auto result_=permutations_[masks[node]._Find_first()];std::array<int, 6> result;for(int i=0; i<6; ++i) result[result_[i]]=i+1; answer(result.data());}

컴파일 시 표준 에러 (stderr) 메시지

scales.cpp: In member function 'int Query::operator()(P) const':
scales.cpp:5:62: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
    5 | std::array<std::pair<unsigned char, unsigned char>, 3> pairs;for(int index=0; index<3; ++index)
      |                                                              ^~~
scales.cpp:6:44: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
    6 | pairs[index]={it[parameter[index]], index};std::sort(begin(pairs), end(pairs),[&](auto first, auto sec){return first.first<sec.first;});if(type==3){
      |                                            ^~~
scales.cpp: In function 'void init(int)':
scales.cpp:28:64: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
   28 | auto const get=[&](int index)->P{return permutations_[index];};for(int index=0, value=1; index<(int)pow3.size(); ++index, value*=3)
      |                                                                ^~~
scales.cpp:29:19: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
   29 | pow3[index]=value;for(int layer=numLayer; layer>=0; --layer)
      |                   ^~~
scales.cpp:29:19: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
scales.cpp:30:60: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
   30 | layerOf.insert(layerOf.end(), pow3[numLayer-layer], layer);masks.resize(layerOf.size());bestQuery.resize(layerOf.size());masks[0]=~ M{};bestQuery={{{1,{4,2}},{3,{5,3,1}},{0,{5,3,1}},{3,{5,3,1}},{2,{4,3,1}},{3,{5,4,1,2}},{3,{5,4,3,2}},{3,{0,3,1,4}},{3,{0,4,1,5}},{3,{0,4,3,5}},{0,{4,3,1}},{3,{5,4,2,1}},{3,{5,4,2,3}},{3,{1,3,2,5}},{3,{2,4,3,5}},{3,{1,4,2,5}},{2,{5,4}},{3,{5,4,1,3}},{1,{4,2,1}},{3,{0,3,1,4}},{2,{5,3,2}},{3,{5,0,1,4}},{3,{1,3,2,5}},{3,{5,0,1,2}},{2,{4,3}},{0,{5,2}},{3,{5,0,2,3}},{3,{4,0,2,3}},{3,{5,4,2,1}},{3,{5,2,0,1}},{2,{4,3}},{2,{3,1}},{1,{4,3,2}},{3,{5,0,3,4}},{2,{5,4,3}},{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,2}},{1,{3,2,1}},{1,{3,2,1}},{3,{5,3,0,2}},{1,{5,2}},{3,{5,4,2,1}},{1,{5,2,1}},{1,{5,2,1}},{3,{4,3,1,2}},{3,{3,0,1,2}},{3,{4,0,2,3}},{3,{4,3,0,2}},{1,{2,1}},{2,{3,2,1}},{3,{4,3,1,2}},{3,{4,3,1,2}},{1,{3,2}},{1,{3,2,1}},{1,{3,2}},{2,{5,3,2}},{1,{5,2,1}},{1,{5,3,2}},{0,{5,4}},{3,{4,3,0,2}},{1,{5,4,3}},{1,{4,3,1}},{3,{5,4,2,3}},{1,{5,4,3}},{2,{5,4,3}},{1,{5,4,2}},{2,{4,3,2}},{1,{5,3,1}},{3,{0,3,2,4}},{1,{4,3,2}},{0,{5,3}},{0,{5,3}},{3,{5,0,1,4}},{1,{3,2}},{1,{4,3}},{0,{3,2}},{1,{5,3}},{1,{3,1}},{1,{2,1}},{1,{3,1}},{1,{3,2}},{3,{4,0,1,2}},{1,{5,2,1}},{1,{5,2,1}},{1,{2,1}},{1,{4,2,1}},{3,{5,3,1,2}},{1,{5,4,2}},{3,{5,4,1,2}},{1,{5,3,2}},{3,{1,4,2,5}},{1,{5,4,1}},{3,{5,0,1,4}},{3,{5,1,2,4}},{2,{5,4}},{2,{4,2,1}},{3,{5,1,2,4}},{1,{5,4,1}},{1,{5,4,1}},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},}};auto const process=[&]{
      |                                                            ^~~~~
scales.cpp: In lambda function:
scales.cpp:32:60: warning: declaration of 'process' shadows a previous local [-Wshadow]
   32 | Query best;int bestValue=INT_MAX;int numFound=1;auto const process=[&](Query query){
      |                                                            ^~~~~~~
scales.cpp:30: note: shadowed declaration is here
   30 | layerOf.insert(layerOf.end(), pow3[numLayer-layer], layer);masks.resize(layerOf.size());bestQuery.resize(layerOf.size());masks[0]=~ M{};bestQuery={{{1,{4,2}},{3,{5,3,1}},{0,{5,3,1}},{3,{5,3,1}},{2,{4,3,1}},{3,{5,4,1,2}},{3,{5,4,3,2}},{3,{0,3,1,4}},{3,{0,4,1,5}},{3,{0,4,3,5}},{0,{4,3,1}},{3,{5,4,2,1}},{3,{5,4,2,3}},{3,{1,3,2,5}},{3,{2,4,3,5}},{3,{1,4,2,5}},{2,{5,4}},{3,{5,4,1,3}},{1,{4,2,1}},{3,{0,3,1,4}},{2,{5,3,2}},{3,{5,0,1,4}},{3,{1,3,2,5}},{3,{5,0,1,2}},{2,{4,3}},{0,{5,2}},{3,{5,0,2,3}},{3,{4,0,2,3}},{3,{5,4,2,1}},{3,{5,2,0,1}},{2,{4,3}},{2,{3,1}},{1,{4,3,2}},{3,{5,0,3,4}},{2,{5,4,3}},{2,{2,1}},{2,{4,1}},{1,{5,4,1}},{2,{3,2}},{2,{4,3}},{1,{5,2}},{1,{5,2}},{0,{5,3,1}},{3,{4,3,2,1}},{3,{5,4,2,1}},{3,{0,2,1,4}},{3,{0,3,2,4}},{1,{3,2,1}},{1,{5,4,2}},{1,{5,3,1}},{1,{5,4,3}},{3,{5,4,0,1}},{1,{5,4,1}},{2,{5,2,1}},{1,{5,4,3}},{1,{4,3,1}},{1,{5,3,2}},{1,{5,3,2}},{1,{4,1}},{0,{5,4,2}},{2,{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}},{1,{4,3,1}},{3,{5,4,2,3}},{1,{5,4,3}},{2,{5,4,3}},{1,{5,4,2}},{2,{4,3,2}},{1,{5,3,1}},{3,{0,3,2,4}},{1,{4,3,2}},{0,{5,3}},{0,{5,3}},{3,{5,0,1,4}},{1,{3,2}},{1,{4,3}},{0,{3,2}},{1,{5,3}},{1,{3,1}},{1,{2,1}},{1,{3,1}},{1,{3,2}},{3,{4,0,1,2}},{1,{5,2,1}},{1,{5,2,1}},{1,{2,1}},{1,{4,2,1}},{3,{5,3,1,2}},{1,{5,4,2}},{3,{5,4,1,2}},{1,{5,3,2}},{3,{1,4,2,5}},{1,{5,4,1}},{3,{5,0,1,4}},{3,{5,1,2,4}},{2,{5,4}},{2,{4,2,1}},{3,{5,1,2,4}},{1,{5,4,1}},{1,{5,4,1}},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},}};auto const process=[&]{
      | 
scales.cpp: In function 'void init(int)':
scales.cpp:45:34: warning: declaration of 'it' shadows a previous local [-Wshadow]
   45 | std::cout<<it.type<<' ';for(auto it: it.parameter) std::cout<<it<<' ';std::cout<<'\n';}
      |                                  ^~
scales.cpp:44:10: note: shadowed declaration is here
   44 | for(auto it: bestQuery){
      |          ^~
scales.cpp:24:199: warning: unused parameter 'T' [-Wunused-parameter]
   24 | };int const numLayer=6;std::mt19937 engine;std::array<P, 720> permutations_;std::array<int, numLayer+1> pow3;std::vector<int> layerOf;std::vector<M> masks;std::vector<Query> bestQuery;void init(int T) {
      |                                                                                                                                                                                                   ~~~~^
scales.cpp: In function 'void orderCoins()':
scales.cpp:48:12: warning: this 'while' clause does not guard... [-Wmisleading-indentation]
   48 | int node=0;while(masks[node].count()!=1)
      |            ^~~~~
scales.cpp:49:37: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'while'
   49 | node=node*3+1+bestQuery[node].get();auto result_=permutations_[masks[node]._Find_first()];std::array<int, 6> result;for(int i=0; i<6; ++i)
      |                                     ^~~~
scales.cpp:49:117: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
   49 | node=node*3+1+bestQuery[node].get();auto result_=permutations_[masks[node]._Find_first()];std::array<int, 6> result;for(int i=0; i<6; ++i)
      |                                                                                                                     ^~~
scales.cpp:50:28: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
   50 | result[result_[i]]=i+1;    answer(result.data());}
      |                            ^~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...