# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
120190 | dorijanlendvaj | 저울 (IOI15_scales) | C++14 | 7 ms | 512 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "scales.h"
#include <bits/stdc++.h>
using namespace std;
#define vi vector<int>
#define pb push_back
void init(int T) {
/* ... */
}
int A(int a,int b,int c)
{
return getLightest(a,b,c);
}
int B(int a,int b,int c)
{
return getMedian(a,b,c);
}
int C(int a,int b,int c)
{
return getHeaviest(a,b,c);
}
int D(int a,int b,int c,int d)
{
return getNextLightest(a,b,c,d);
}
int min(int a,int b,int c)
{
return min(min(a,b),c);
}
int max(int a,int b,int c)
{
return max(max(a,b),c);
}
int med(int a,int b,int c)
{
return a+b+c-min(a,b,c)-max(a,b,c);
}
int nex(int a,int b,int c,int d)
{
int u[]={a,b,c,d};
sort(u,u+4);
for (int i=0;i<4;++i) if (u[i]==d) return u[(i+1)%4];
}
void orderCoins() {
/*int a=A(1,2,3),b=B(1,2,3),c=6-a-b;
int d=A(4,5,6),e=B(4,5,6),f=15-d-e;*/
//int a=A(1,2,3),d=A(4,5,6),p=A(2,4,6),q;
//int b=a==1?2:1,c=6-a-b,e=d==4?5:4,f=15-d-e;
//int g=D(a,b,c,d),h=D(a,b,c,e),k=A(c,d,a),m=A(a,f,c),n=D(a,b,c,f),o=A(a,e,c);
//cout<<a<<' '<<b<<' '<<c<<' '<<d<<' '<<e<<' '<<f<<' '<<g<<' '<<h<<' '<<k<<endl;
int com[9][4]={{5,4,2,3},{4,6,2,1},{2,3,4,1},{3,1,5,6},{1,2,6,5},{2,6,5,4},{3,2,4,5},{4,1,2,6},{4,5,6,1}};
vi res;
for (int i=0;i<6;++i) res.pb(D(com[i][0],com[i][1],com[i][2],com[i][3]));
res.pb(A(com[6][0],com[6][1],com[6][2]));
res.pb(B(com[7][0],com[7][1],com[7][2]));
res.pb(C(com[8][0],com[8][1],com[8][2]));
int z[]={1,2,3,4,5,6};
do
{
bool pos=1;
int la=-1;
//if (min(z[0],z[1],z[2])!=z[a-1]) pos=0,la=0;
//if (min(z[1],z[3],z[5])!=z[p-1]) pos=0,la=1;
//if (max(z[0],z[1],z[2])!=z[c-1]) pos=0,la=1;
//if (min(z[3],z[4],z[5])!=z[d-1]) pos=0,la=2;
//if (max(z[3],z[4],z[5])!=z[f-1]) pos=0,la=3;
/*if (nex(z[a-1],z[b-1],z[c-1],z[d-1])!=z[g-1]) pos=0,la=4;
if (nex(z[a-1],z[b-1],z[c-1],z[e-1])!=z[h-1]) pos=0,la=5;
if (min(z[c-1],z[d-1],z[a-1])!=z[k-1]) pos=0,la=6;
if (min(z[f-1],z[c-1],z[a-1])!=z[m-1]) pos=0,la=7;
if (nex(z[a-1],z[b-1],z[c-1],z[f-1])!=z[n-1]) pos=0,la=8;
if (min(z[a-1],z[e-1],z[c-1])!=z[o-1]) pos=0,la=9;*/
for (int i=0;i<6;++i) if (nex(z[com[i][0]-1],z[com[i][1]-1],z[com[i][2]-1],z[com[i][3]-1])!=z[res[i]-1]) pos=0,la=i;
if (min(z[com[6][0]-1],z[com[6][1]-1],z[com[6][2]-1])!=z[res[6]-1]) pos=0,la=6;
if (med(z[com[7][0]-1],z[com[7][1]-1],z[com[7][2]-1])!=z[res[7]-1]) pos=0,la=7;
if (max(z[com[8][0]-1],z[com[8][1]-1],z[com[8][2]-1])!=z[res[8]-1]) pos=0,la=8;
vi x(z,z+6);
int uu[]={5,4,1,2,6,3};
vi y(uu,uu+6);
/*if (x==y)
{
cout<<a<<' '<<b<<' '<<c<<' '<<d<<' '<<e<<' '<<f<<' '<<g<<' '<<h<<' '<<k<<endl;
cout<<nex(z[a-1],z[b-1],z[c-1],z[d-1])<<endl;
cout<<nex(z[a-1],z[b-1],z[c-1],z[e-1])<<endl;
cout<<la<<endl;
}*/
if (pos)
{
int u[]={0,0,0,0,0,0};
for (int i=0;i<6;++i) u[z[i]-1]=i+1;
//for (int i=0;i<6;++i) cout<<u[i]<<' ';
//cout<<endl;
answer(u);
}
}
while (next_permutation(z,z+6));
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |