Submission #120188

#TimeUsernameProblemLanguageResultExecution timeMemory
120188dorijanlendvajScales (IOI15_scales)C++14
0 / 100
9 ms384 KiB
#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,4},{1,2,6,5},{3,4,5,4},{1,4,6,5},{4,2,5,6},{2,5,6,1}};
    vi res;
    for (int i=0;i<4;++i) res.pb(D(com[i][0],com[i][1],com[i][2],com[i][3]));
    res.pb(A(com[5][0],com[5][1],com[5][2])); 
    res.pb(A(com[6][0],com[6][1],com[6][2])); 
    res.pb(A(com[7][0],com[7][1],com[7][2])); 
    res.pb(B(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<4;++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[5][0]-1],z[com[5][1]-1],z[com[5][2]-1])!=z[res[4]-1]) pos=0,la=5;
    	if (min(z[com[6][0]-1],z[com[6][1]-1],z[com[6][2]-1])!=z[res[5]-1]) pos=0,la=6;
    	if (min(z[com[7][0]-1],z[com[7][1]-1],z[com[7][2]-1])!=z[res[6]-1]) pos=0,la=7;
    	if (med(z[com[8][0]-1],z[com[8][1]-1],z[com[8][2]-1])!=z[res[7]-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));
}

Compilation message (stderr)

In file included from grader.c:2:0:
graderlib.c: In function 'void answer(int*)':
graderlib.c:53:5: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
     if (_ghksjhdfkae19ga_ > 1) 
     ^~
graderlib.c:56:2: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
  for (i = 0; i < 6; i++) {
  ^~~
scales.cpp: In function 'void init(int)':
scales.cpp:7:15: warning: unused parameter 'T' [-Wunused-parameter]
 void init(int T) {
               ^
scales.cpp: In function 'void orderCoins()':
scales.cpp:71:10: warning: variable 'la' set but not used [-Wunused-but-set-variable]
      int la=-1;
          ^~
scales.cpp: In function 'int nex(int, int, int, int)':
scales.cpp:51:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
#Verdict Execution timeMemoryGrader output
Fetching results...