#include "scales.h"
#include <bits/stdc++.h>
using namespace std;
void init(int T){
return ;
}
//int ww[7];
//int getHeaviest(int A, int B, int C);
//int getLightest(int A, int B, int C);
//int getMedian(int A, int B, int C);
//int getNextLightest(int A, int B, int C, int D);
//void answer(int W[6]);
vector<int> ers(vector<int> v,int x){
vector<int> res;
for(auto i:v){
if(i==x)continue;
res.push_back(i);
}
return res;
}
void orderCoins(){
int ss = 0;
vector<int> rem;
int ans[6] = {0};
for(int i = 1;i<=6;i++)rem.push_back(i);
random_shuffle(rem.begin(),rem.end());
int x = getLightest(rem[0],rem[1],rem[2]);
int y = getLightest(rem[3],rem[4],rem[5]);
int z = getLightest(x,y,((x!=rem[0]&&y!=rem[0])?rem[0]:((x!=rem[1]&&y!=rem[1])?rem[1]:rem[2])));
ss = (z==x?1:0);
ans[0] = z;
rem = ers(rem,z);
if(ss)x = getLightest(rem[0],rem[1],rem[2]);
if(!ss)y = getLightest(rem[2],rem[3],rem[4]);
if(x==y){
z = x;
ss = 3;
}else{
z = getLightest(x,y,((x!=rem[0]&&y!=rem[0])?rem[0]:((x!=rem[1]&&y!=rem[1])?rem[1]:rem[2])));
ss = (z==x?1:0);
}
ans[1] = z;
rem = ers(rem,z);
if(ss>0)x = getLightest(rem[0],rem[1],rem[2]);
if(ss==0||ss==3)y = getLightest(rem[1],rem[2],rem[3]);
long long mi = 1e9;
if(x!=y){
z = getLightest(x,y,((x!=rem[0]&&y!=rem[0])?rem[0]:((x!=rem[1]&&y!=rem[1])?rem[1]:rem[2])));
if(z==rem[0]){
mi = y;
}else{
mi = x;
}
}else {
z = x;
mi = getLightest(rem[0],(z==rem[1]?rem[2]:rem[1]),rem[3]);
}
ans[2] = z;
rem = ers(rem,z);
ans[3] = mi;
z = getHeaviest(rem[0],rem[1],rem[2]);
rem = ers(rem,mi);
ans[5] = z;
rem = ers(rem,z);
ans[4] = rem[0];
int he[] = {ans[0],ans[1],ans[2],ans[3],ans[4],ans[5]};
answer(he);
return ;
}
/*
int main(){
ww[1] = 2 , ww[2] = 1, ww[3] = 3 , ww[4] = 4, ww[5] =5 , ww[6] = 6;
orderCoins();
}*/
Compilation message
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:62:14: warning: conversion from 'long long int' to 'int' may change value [-Wconversion]
62 | ans[3] = mi;
| ^~
scales.cpp:64:19: warning: conversion from 'long long int' to 'int' may change value [-Wconversion]
64 | rem = ers(rem,mi);
| ^~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Partially correct |
0 ms |
212 KB |
Output is partially correct |
2 |
Partially correct |
0 ms |
212 KB |
Output is partially correct |
3 |
Partially correct |
0 ms |
212 KB |
Output is partially correct |
4 |
Partially correct |
0 ms |
212 KB |
Output is partially correct |
5 |
Partially correct |
0 ms |
212 KB |
Output is partially correct |
6 |
Partially correct |
0 ms |
212 KB |
Output is partially correct |
7 |
Partially correct |
0 ms |
212 KB |
Output is partially correct |
8 |
Partially correct |
1 ms |
212 KB |
Output is partially correct |
9 |
Partially correct |
0 ms |
212 KB |
Output is partially correct |
10 |
Partially correct |
0 ms |
212 KB |
Output is partially correct |
11 |
Partially correct |
1 ms |
212 KB |
Output is partially correct |
12 |
Partially correct |
0 ms |
212 KB |
Output is partially correct |
13 |
Partially correct |
0 ms |
212 KB |
Output is partially correct |
14 |
Partially correct |
0 ms |
212 KB |
Output is partially correct |
15 |
Partially correct |
0 ms |
212 KB |
Output is partially correct |
16 |
Partially correct |
1 ms |
212 KB |
Output is partially correct |
17 |
Partially correct |
0 ms |
212 KB |
Output is partially correct |
18 |
Partially correct |
0 ms |
212 KB |
Output is partially correct |
19 |
Partially correct |
0 ms |
212 KB |
Output is partially correct |
20 |
Partially correct |
1 ms |
212 KB |
Output is partially correct |
21 |
Partially correct |
1 ms |
212 KB |
Output is partially correct |
22 |
Partially correct |
0 ms |
212 KB |
Output is partially correct |
23 |
Partially correct |
0 ms |
212 KB |
Output is partially correct |
24 |
Partially correct |
0 ms |
212 KB |
Output is partially correct |
25 |
Partially correct |
0 ms |
212 KB |
Output is partially correct |
26 |
Partially correct |
0 ms |
212 KB |
Output is partially correct |
27 |
Partially correct |
0 ms |
212 KB |
Output is partially correct |
28 |
Partially correct |
1 ms |
212 KB |
Output is partially correct |
29 |
Partially correct |
0 ms |
212 KB |
Output is partially correct |
30 |
Partially correct |
0 ms |
212 KB |
Output is partially correct |
31 |
Partially correct |
0 ms |
212 KB |
Output is partially correct |
32 |
Partially correct |
1 ms |
212 KB |
Output is partially correct |
33 |
Partially correct |
0 ms |
212 KB |
Output is partially correct |
34 |
Partially correct |
0 ms |
212 KB |
Output is partially correct |
35 |
Partially correct |
0 ms |
212 KB |
Output is partially correct |
36 |
Partially correct |
0 ms |
212 KB |
Output is partially correct |
37 |
Partially correct |
0 ms |
212 KB |
Output is partially correct |
38 |
Partially correct |
0 ms |
212 KB |
Output is partially correct |
39 |
Partially correct |
0 ms |
212 KB |
Output is partially correct |
40 |
Partially correct |
0 ms |
212 KB |
Output is partially correct |