跳到正文

生活·游记

APIO2023 游记

MatrixGroup约 11 分钟
原文
文章信息与版本

文章信息

发布
2023年5月20日
收录
2025年12月12日
更新
2026年11月17日
篇幅
约 11 分钟

版本

  1. v1当前

Day −x-x

得知有 APIO 可以打。

Day −y(y<x)-y(y<x)

得知只有线上了。

Day −z(z<y)-z(z<y)

参加 PKUSC。

Day −w(w<z)-w(w<z)

知道有测试赛,测试了如何登录账号。

颓 nandgames。

Thursday

晚上开幕式没参加。

Friday

润去听纸糊串。听不懂。颓名字竞技场。

听怎么写解释器,听懂了,懒得写。

Saturday

T3 写电路?1212 分简单,写。调。过。

评测机卡?感谢 Cyberland Chemistry Foundation 倾情选择的南夫拉斯机子。

T1 K≤30K\le30 很好写啊。写。调。调。调。调。调。过。

诶剩下 33 分很显然啊。过。

T2 2828 分很好写啊。写。调。换做法。调。过。

T3 Sub 5454 简单,写写试试看。试试看。试试看。试试看。试试看。试试看。试试看。试试看。过不了。

100+28+12100+28+12。听说 [1,r],[l,n][1,r],[l,n] T2 能拿 4040。

C++
#include "abc.h"
#include <cmath>
#include <string>
#include <cstring>
#include <vector>
#include <algorithm>
#include <numeric>
#include <iostream>
#define rep(i,n) for(int i=0,_##i##__end=(n);i<_##i##__end;++i)
#define per(i,n) for(int i=(n)-1;i>=0;--i)
#define rep1(i,n) for(int i=1,_##i##__end=(n);i<=_##i##__end;++i)
#define per1(i,n) for(int i=(n);i>=1;--i)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define AND 8
#define OR 14
#define XOR 6
#define NAND 7
#define NOT 5
#define NOR 1
#define COPY 10
#define NOT_R 3
#define COPY_R 12
#define IMPL 13
#define NIMPL 2
#define IMPL_BY 11
#define NIMPL_BY 4
#define ZERO 0
#define ONE 15
#define EQ 9
typedef long long ll;
using namespace std;
string cur[1506];
int tempt[706];
int alice(const int n, const char names[][5], const unsigned short numbers[], bool outputs_alice[])//i的排名,排名为i,i的数,排名为i的数 
{
	rep(i,n)cur[i]=names[i];
	sort(cur,cur+n);
	int idx=52*n;
	rep(i,n)
	{
		tempt[i]=lower_bound(cur,cur+n,string(names[i]))-cur;
	}
	rep(i,n)
	{
		rep(j,10) outputs_alice[i*10+j]=(tempt[i]>>j)&1;
	}
	rep(i,n)
	{
		rep(j,10) outputs_alice[n*10+tempt[i]*10+j]=(i>>j)&1;
	}
	rep(i,n)
	{
		rep(j,16) outputs_alice[n*20+i*16+j]=(numbers[i]>>j)&1;
	}
	rep(i,n)
	{
		rep(j,16) outputs_alice[n*35+tempt[i]*16+j]=(numbers[i]>>j)&1;
	}
	return idx;
}
int bob(const int m, const char senders[][5],const char recipients[][5], bool outputs_bob[])
{
	rep(i,m)
	{
		cur[i*2+1]=senders[i];cur[i*2]=recipients[i]; 
	}
	sort(cur,cur+2*m);
	int n=unique(cur,cur+2*m)-cur;
	rep(i,m*30)outputs_bob[i]=0;
	rep(i,n)
	{
		int v1=lower_bound(cur,cur+n,string(senders[i]))-cur;
		int v2=lower_bound(cur,cur+n,string(recipients[i]))-cur;
		outputs_bob[v1*n+v2]=1;
	}
	return m*30;
}
int current;
int const_0,const_1;
int op[10000005],opr[10000005][2];
int make_op(int opkind,int lhs,int rhs)
{
	op[current]=opkind;opr[current][0]=lhs;opr[current][1]=rhs;
	return current++;
}
int make_op(int opkind,int var)
{
	return make_op(opkind,var,var);
}
struct unsigned_short{
	int bit[16];
};
unsigned_short out[1005];
unsigned_short operator~(const unsigned_short&x)
{
	unsigned_short ret;
	rep(i,16) ret.bit[i]=make_op(NOT,x.bit[i]);
	return ret;
}
unsigned_short operator&(const unsigned_short&x,const unsigned_short&y)
{
	unsigned_short ret;
	rep(i,16) ret.bit[i]=make_op(AND,x.bit[i],y.bit[i]);
	return ret;
}
unsigned_short operator|(const unsigned_short&x,const unsigned_short&y)
{
	unsigned_short ret;
	rep(i,16) ret.bit[i]=make_op(OR,x.bit[i],y.bit[i]);
	return ret;
}
int operator==(const unsigned_short&x,const unsigned_short&y)
{
	int ret=make_op(COPY,const_1);
	rep(i,16) ret=make_op(AND,make_op(EQ,x.bit[i],y.bit[i]));
	return ret;
}
int operator==(const unsigned_short&x,int y)
{
	int ret=make_op(COPY,const_1);
	rep(i,16) if((y>>i)&1) ret=make_op(AND,ret,x.bit[i]); else ret=make_op(NIMPL,ret,x.bit[i]);
	return ret;
}
unsigned_short operator&(const unsigned_short&x,int y)
{
	unsigned_short ret;
	rep(i,16) ret.bit[i]=make_op(AND,x.bit[i],y);
	return ret;
}
unsigned_short operator+(const unsigned_short&x,const unsigned_short&y)
{
	unsigned_short ret;
	int carry=make_op(COPY,const_0);
	rep(i,16)
	{
		int h=make_op(AND,x.bit[i],y.bit[i]);
		int l=make_op(XOR,x.bit[i],y.bit[i]);
		int h2=make_op(AND,l,carry);
		ret.bit[i]=make_op(XOR,l,carry);
		carry=make_op(OR,h,h2);
	}
	return ret;
}
unsigned_short selector(int L,int R,unsigned_int k,int numeral_len)//[L,R)
{
	unsigned_short answer;
	rep(i,numeral_len) answer.bit[i]=0;
	for(int i=L;i<R;i+=numeral_len)
	{
		int ret=make_op(COPY,const_1);int v=(i-L)/numeral_len;
		rep(j,numeral_len)
		{
			if((v>>j)&1) ret=make_op(AND,ret,k.bit[i]);
			else ret=make_op(NIMPL,ret,k.bit[i]);
		}
		rep(j,numeral_len) answer.bit[j]=make_op(OR,answer.bit[j],make_op(AND,ret,i+j));
	}
	return answer;
}
unsigned_short selector(unsigned_short*a,int n,unsigned_int k,int numeral_len)
{
	unsigned_short answer;
	rep(i,numeral_len) answer.bit[i]=0;
	for(int i=0;i<n;++i)
	{
		int ret=make_op(COPY,const_1);
		rep(j,numeral_len)
		{
			if((i>>j)&1) ret=make_op(AND,ret,k.bit[i]);
			else ret=make_op(NIMPL,ret,k.bit[i]);
		}
		rep(j,numeral_len) answer.bit[j]=make_op(OR,answer.bit[j],make_op(AND,ret,a[i]));
	}
	return answer;
}
unsigned_int person[705];
unsigned_int sum[705];
int circuit(const int la, const int lb, int operations[],int operands[][2], int outputs_circuit[][16])
{
	int n=la/52,m=lb/30;
	current=la+lb;
	const_0=make_op(ZERO,0);const_1=make_op(ONE,1);
	rep(i,n) rep(j,16) out[i].bit[j]=0;
	rep(i,n)
	{
		rep(j,10) person[i].bit[j]=10*i+j;
	}
	rep(i,n) rep(j,n)
	{
		unsigned_short ret;
		rep(k,16) ret.bit[k]=36*n+16*i+k;
		ret=ret&(52*n+i*n+j);
		sum[j]=sum[j]+ret;
	}
	rep(i,n) out[i]=selector(sum,n,person[i],10);
	for(int i=la+lb;i<current;++i)
	{
		operations[i]=op[i];operands[i][0]=opr[i][0];operands[i][1]=opr[i][1];
	}
	rep(i,n) rep(j,16) outputs_circuit[i][j]=out[i].bit[j];
	return current;
}

Sunday

GF 好闪,拜谢 GF。

zxx orz

hgh orz

wmh orz

鉴定为:线上 Ag