8:00 起床,一看怎么 。
10:54 到机房开电脑,更新了6分钟刚好。
11:02 电脑加载好开题
11:09 Corzica 成功签到 M
11:18 wosile 口胡了一个结论并写了 C
11:55 Corzica 切了 K
12:15 wosile 口出狂言说自己 45min 能写掉 F,于是开始写 F
12:25 Phantom2009 切了 E
13:00 wosile 并没有写完 F
13:44 wosile 写完了 F,但是没过样例
14:00 wosile 并没有写完 F
14:26 wosile 过了样例 1234,交了一发结果 WA
14:34 wosile 发现自己样例 5 挂在了第 411 行
14:50 wosile 对着三十万行的样例调出来了
14:52 wosile 终于过了他妈的 F
15:02 Phantom2009 切了 H
15:21 Corzica 切了 J
15:30 开始我们队对着 D 和 I 狂暴交题但是
16:00 没过。7 题 20h rk108
附 F 代码,感觉真不难。可能大家被吓到了。
综上,最大的锅就是我写了他妈三个小时 F。
#include<bits/stdc++.h>
using namespace std;
int read(){
int x=0,c=getchar(),f=1;
while(c<'0' || c>'9'){
if(c=='-')f=-1;
c=getchar();
}
while(c>='0' && c<='9'){
x=(x<<3)+(x<<1)+c-'0';
c=getchar();
}
return f==1?x:-x;
}
struct command{
int t,h,x,y,to;
}f[2000005];
struct robot{
int cid[15];
int l,r;
int hand(int v){
return v==0?l:r;
}
}a[105];
int tot=0;
char tmp[15];
int n,m,k;
void readCommand(command &c){
scanf("%s",tmp);
c.t=tmp[1];
if(tmp[1]=='O'){
c.h=read();
c.x=read();
}
else if(tmp[1]=='W'){
c.h=read();
c.x=read();
c.y=read();
}
else if(tmp[1]=='I'){
c.h=read();
c.x=read();
}
else if(tmp[1]=='E'){
c.h=read();
c.x=read();
c.to=++tot;
readCommand(f[tot]);
}
else if(tmp[1]=='C'){
c.h=read();
}
else if(tmp[1]=='R'){
scanf("%s",tmp);
c.x=tmp[1];
c.to=++tot;
readCommand(f[tot]);
}
}
void trytrigger(int,int,int);
void sLackoff(int id,int g){
if(k<=0)return;
--k;
printf("Robot %d slacks off.\n",id);
if(id!=a[id].r)trytrigger(a[id].r,'L',g);
}
void mOve(int id,int h,int x,int g){
if(k<=0)return;
--k;
if(h==0){
a[id].l=(a[id].l+x)%n;
printf("Robot %d moves its left hand towards Robot %d.\n",id,a[id].l);
}
else{
a[id].r=(a[id].r+x)%n;
printf("Robot %d moves its right hand towards Robot %d.\n",id,a[id].r);
}
if(id!=a[id].r)trytrigger(a[id].r,'O',g);
}
void sWap(int id,int id2,int x,int x2,int g){
if(k<=0)return;
--k;
swap(a[id].cid[x],a[id2].cid[x2]);
printf("Robot %d swaps a line of command with Robot %d.\n",id,id2);
if(id!=a[id].r)trytrigger(a[id].r,'W',g);
}
void mIrror(int id,int x,int from,int g){
if(k<=0)return;
--k;
int &i=a[id].cid[x];
if(f[i].t!='R'){
f[++tot]=f[i];
f[tot].h^=1;
i=tot;
}
else{
f[++tot]=f[i];
f[++tot]=f[f[i].to];
f[tot].h^=1;
f[tot-1].to=tot;
i=tot-1;
}
printf("Robot %d modifies a line of command of Robot %d.\n",from,id);
if(from!=a[from].r)trytrigger(a[from].r,'I',g);
}
void rEplace(int id,int x,int cd,int from,int g){
if(k<=0)return;
--k;
a[id].cid[x]=cd;
printf("Robot %d replaces a line of command of Robot %d.\n",from,id);
if(from!=a[from].r)trytrigger(a[from].r,'E',g);
}
void aCtivate(int id,int from,int g){
if(k<=0)return;
if(from!=-1){
printf("Robot %d activates Robot %d.\n",from,id);
--k;
}
for(int i=1;i<=m;i++){
command c=f[a[id].cid[i]];
if(c.t=='L')sLackoff(id,0);
else if(c.t=='O')mOve(id,c.h,c.x,0);
else if(c.t=='W')sWap(id,a[id].hand(c.h),c.y,c.x,0);
else if(c.t=='I')mIrror(a[id].hand(c.h),c.x,id,0);
else if(c.t=='E')rEplace(a[id].hand(c.h),c.x,c.to,id,0);
else if(c.t=='C')aCtivate(a[id].hand(c.h),id,0);
}
if(from!=-1 && from!=a[from].r)trytrigger(a[from].r,'C',g);
}
void trytrigger(int id,int ft,int g){
if(k<=0)return;
for(int i=1;i<=m;i++){
command c=f[a[id].cid[i]];
if(c.t=='R' && (c.x==ft || (c.x=='R' && g==1))){
c=f[c.to];
if(c.t=='L')sLackoff(id,1);
else if(c.t=='O')mOve(id,c.h,c.x,1);
else if(c.t=='W')sWap(id,a[id].hand(c.h),c.y,c.x,1);
else if(c.t=='I')mIrror(a[id].hand(c.h),c.x,id,1);
else if(c.t=='E')rEplace(a[id].hand(c.h),c.x,c.to,id,1);
else if(c.t=='C')aCtivate(a[id].hand(c.h),id,1);
break;
}
}
}
int main(){
n=read();
m=read();
k=read();
for(int i=0;i<n;i++){
a[i].l=read();
a[i].r=read();
for(int j=1;j<=m;j++){
a[i].cid[j]=++tot;
readCommand(f[tot]);
}
}
int it=0;
while(k>0){
aCtivate(it,-1,0);
it=(it+1==n?0:it+1);
}
return 0;
}