记录编号 |
594938 |
评测结果 |
AAAAAAAAAAAAAAAAAAAA |
题目名称 |
战棋 |
最终得分 |
100 |
用户昵称 |
wdsjl |
是否通过 |
通过 |
代码语言 |
C++ |
运行时间 |
0.144 s |
提交时间 |
2024-10-06 11:30:17 |
内存使用 |
3.57 MiB |
显示代码纯文本
#include <bits/stdc++.h>
using namespace std;
int n,xx,AA,BB,CC;
int cnt_s,cnt_r;
int Getid(){
return xx=(xx*AA+BB)%CC;
}
const int N = 200;
struct node{
int gong,sheng;
char zhong;//鱼人 (”M”,Murloc),要么是海盗 (”P”,Pirate)
char shu;//
}s[N],r[N],chu_s[N],chu_r[N];
int pos_s,pos_r;
int al_s[N],al_r[N];
void init(){
cnt_s=cnt_r=n;
for(int i=0;i<n;i++){
s[i]=chu_s[i];
r[i]=chu_r[i];
}
}
void ml(){
int sum=0;
for(int i=0;i<n;i++){
if(s[i].shu=='L')sum++;
}
for(int i=0;i<n;i++){
if(s[i].zhong=='M')s[i].gong+=20*sum;
if(s[i].shu=='L'&&s[i].zhong=='M')s[i].gong-=20;
}
sum=0;
for(int i=0;i<n;i++){
if(r[i].shu=='L')sum++;
}
for(int i=0;i<n;i++){
if(r[i].zhong=='M')r[i].gong+=20*sum;
if(r[i].shu=='L'&&r[i].zhong=='M')r[i].gong-=20;
}
}
void xuan(){
int x,y;
x=Getid();
y=Getid();
pos_s=x%cnt_s;
pos_r=y%cnt_r;
}
void pc(){
int sum=0;
for(int i=0;i<cnt_s;i++){
if(s[i].shu=='C')sum++;
}
if(s[pos_s].zhong=='P')s[pos_s].gong+=20*sum,s[pos_s].sheng+=20*sum;
if(s[pos_s].zhong=='P'&&s[pos_s].shu=='C')s[pos_s].gong-=20,s[pos_s].sheng-=20;
sum=0;
for(int i=0;i<cnt_r;i++){
if(r[i].shu=='C')sum++;
}
if(r[pos_r].zhong=='P')r[pos_r].gong+=20*sum,r[pos_r].sheng+=20*sum;
if(r[pos_r].zhong=='P'&&r[pos_r].shu=='C')r[pos_r].gong-=20,r[pos_r].sheng-=20;
}
void g(){
if(s[pos_s].sheng<=0){
if(s[pos_s].shu=='K'){
for(int i=0;i<cnt_s;i++){
if(s[i].zhong=='M')s[i].gong+=20,s[i].sheng+=20;
}
}
if(s[pos_s].zhong=='P'){
for(int i=0;i<cnt_s;i++){
if(s[i].shu=='G')s[i].gong+=50;
}
}
if(s[pos_s].shu=='L'){
for(int i=0;i<cnt_s;i++){
if(s[i].zhong=='M')s[i].gong-=20;
}
}
for(int i=pos_s;i<cnt_s;i++){
s[i]=s[i+1];
}
cnt_s--;
}
if(r[pos_r].sheng<=0){
if(r[pos_r].shu=='K'){
for(int i=0;i<n;i++){
if(r[i].zhong=='M'&&al_r[i]==0)r[i].gong+=20,r[i].sheng+=20;
}
}
if(r[pos_r].zhong=='P'){
for(int i=0;i<n;i++){
if(r[i].shu=='G'&&al_r[i]==0)r[i].gong+=50;
}
}
if(r[pos_r].shu=='L'){
for(int i=0;i<n;i++){
if(r[i].zhong=='M'&&al_r[i]==0)r[i].gong-=20;
}
}
for(int i=pos_r;i<cnt_r;i++){
r[i]=r[i+1];
}
cnt_r--;
}
}
int main(){
freopen("chess.in","r",stdin);
freopen("chess.out","w",stdout);
scanf("%d%d%d%d%d",&n,&xx,&AA,&BB,&CC);
for(int i=0;i<n;i++){
cin>>chu_s[i].gong>>chu_s[i].sheng;
cin>>chu_s[i].zhong>>chu_s[i].shu;
}
for(int i=0;i<n;i++){
cin>>chu_r[i].gong>>chu_r[i].sheng;
cin>>chu_r[i].zhong>>chu_r[i].shu;
}
int res_s=0,res_r=0;
for(int lun=1;lun<=500;lun++){
init();
ml();
while(cnt_s&&cnt_r){
xuan();
pc();
s[pos_s].sheng-=r[pos_r].gong;
r[pos_r].sheng-=s[pos_s].gong;
g();
}
res_s+=cnt_s;
res_r+=cnt_r;
}
printf("%d %d",res_s,res_r);
return 0;
}