QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#113120 | #2785. Boxes with souvenirs | myee | Compile Error | / | / | C++11 | 3.5kb | 2023-06-16 14:45:54 | 2023-06-16 14:45:56 |
Judging History
你现在查看的是最新测评结果
- [2023-08-10 23:21:45]
- System Update: QOJ starts to keep a history of the judgings of all the submissions.
- [2023-06-16 14:45:56]
- 评测
- 测评结果:Compile Error
- 用时:0ms
- 内存:0kb
- [2023-06-16 14:45:54]
- 提交
answer
#include "scales.h"
#include <algorithm>
#include <stdio.h>
#include <vector>
namespace
{
typedef long long llt;
typedef unsigned uint;typedef unsigned long long ullt;
typedef bool bol;typedef char chr;typedef void voi;
typedef double dbl;
template<typename T>bol _max(T&a,T b){return(a<b)?a=b,true:false;}
template<typename T>bol _min(T&a,T b){return(b<a)?a=b,true:false;}
template<typename T>T lowbit(T n){return n&-n;}
template<typename T>T gcd(T a,T b){return b?gcd(b,a%b):a;}
template<typename T>T lcm(T a,T b){return(a!=0||b!=0)?a/gcd(a,b)*b:(T)0;}
template<typename T>T exgcd(T a,T b,T&x,T&y){if(b!=0){T ans=exgcd(b,a%b,y,x);y-=a/b*x;return ans;}else return y=0,x=1,a;}
template<typename T>T power(T base,T index,T mod)
{
T ans=1%mod;
while(index)
{
if(index&1)ans=ans*base%mod;
base=base*base%mod,index>>=1;
}
return ans;
}
uint Per[805][6],Ans[805][125];
uint Son[3][2005],Now[2005],tp;
uint X[125],Y[125],Z[125],W[125];
bol build(std::vector<uint>V,uint s)
{
if(V.empty())return true;
// printf("%u %u\n",(uint)V.size(),s);
uint t=tp++;
if(V.size()==1)return Now[t]=-1,Son[0][t]=V[0],true;
s/=3;
for(uint&e=Now[t]=0;e<120;e++)
{
std::vector<uint>S[3];for(auto j:V)S[Ans[j][e]].push_back(j);
// printf("%u %u %u\n",(uint)X[0].size(),(uint)X[1].size(),(uint)X[2].size());
if(S[0].size()<=s&&S[1].size()<=s&&S[2].size()<=s&&
(Son[0][t]=tp,build(S[0],s))&&(Son[1][t]=tp,build(S[1],s))&&(Son[2][t]=tp,build(S[2],s)))
return true;
tp=t+1;
}
return false;
}
voi output(uint id)
{
static int P[6];
for(uint i=0;i<6;i++)
P[i]=Per[id][i]+1;
answer(P);
}
voi bzr()
{
for(uint i=0;i<6;i++)Per[0][i]=i;
for(uint i=1;i<720;i++)
{
for(uint j=0;j<6;j++)Per[i][j]=Per[i-1][j];
std::next_permutation(Per[i],Per[i]+6);
}
for(uint i=0,t=0;i<6;i++)for(uint j=0;j<i;j++)for(uint k=0;k<j;k++)
X[t+40]=X[t+20]=X[t]=i,Y[t+40]=Y[t+20]=Y[t]=j,Z[t+40]=Z[t+20]=Z[t]=k,t++;
for(uint i=0,t=60;i<6;i++)for(uint j=0;j<i;j++)for(uint k=0;k<j;k++)
for(uint l=0;l<6;l++)if(i!=l&&j!=l&&k!=l)
X[t]=i,Y[t]=j,Z[t]=k,W[t]=l,t++;
std::vector<uint>V;
for(uint i=0;i<720;i++)
{
V.push_back(i);
for(uint j=0;j<20;j++)for(uint k=0,t=0;k<6;k++)if(Per[i][k]==X[j]||Per[i][k]==Y[j]||Per[i][k]==Z[j])
Ans[i][t++*20+j]=Per[i][k]==Z[j]?2:Per[i][k]==Y[j];
for(uint p=60;p<120;p++)for(uint j=0;j<6;j++)if(Per[i][j]==W[p])
{
uint w=-1;
for(uint k=j+1;!~w;k=(k+1)%6)if(Per[i][k]==X[p]||Per[i][k]==Y[p]||Per[i][k]==Z[p])w=Per[i][k];
Ans[i][p]=w==Z[p]?2:w==Y[p];
// printf("%u %u\n",p,w);
}
}
if(!build(V,729))
puts("qwq"),exit(233);
// exit(0);
}
voi solve()
{
uint t=0;
while(~Now[t])
{
if(Now[t]<60)
{
uint op=Now[t]/20,x=X[Now[t]]+1,y=Y[Now[t]]+1,z=Z[Now[t]]+1;
uint v=(op?op==2?getHeaviest:getMedian:getLightest)(x,y,z);
t=Son[v==z?2:v==y][t];
}
else
{
uint x=X[Now[t]]+1,y=Y[Now[t]]+1,z=Z[Now[t]]+1,w=W[Now[t]]+1;
uint v=getNextLightest(x,y,z,w);
t=Son[v==z?2:v==y][t];
}
}
output(Son[0][t]);
}
}
void init(int T)
{
bzr();
}
void orderCoins()
{
solve();
}
/*
g++ 230.cpp grader.cpp -o code -std=c++11
*/
Details
answer.code:1:10: fatal error: scales.h: No such file or directory 1 | #include "scales.h" | ^~~~~~~~~~ compilation terminated.