记录编号 |
595019 |
评测结果 |
AAWWWWWWWWWWWWWWAWWW |
题目名称 |
战棋 |
最终得分 |
15 |
用户昵称 |
袁书杰 |
是否通过 |
未通过 |
代码语言 |
C++ |
运行时间 |
0.195 s |
提交时间 |
2024-10-06 22:20:01 |
内存使用 |
3.40 MiB |
显示代码纯文本
#include<bits/stdc++.h>
#define int long long
using namespace std;
int n,xx,AA,BB,CC,nows,nowr,scores,scorer,original_AA,original_BB,original_CC;
int getid() {
return xx=(xx*AA+BB)%CC;
}
struct nodes {
int fight;
int life;
char people;
char special;
bool die;
} ropes[1005],originals[1005];
struct noder {
int fight;
int life;
char people;
char special;
bool die;
} roper[1005],originalr[1005];
void init() {
nows=nowr=n;
AA=original_AA;
BB=original_BB;
CC=original_CC;
for(int i=1; i<=n; i++) {
ropes[i].fight=originals[i].fight;
ropes[i].life=originals[i].life;
ropes[i].people=originals[i].people;
ropes[i].special=originals[i].special;
ropes[i].die=false;
}
for(int i=1; i<=n; i++) {
roper[i].fight=originalr[i].fight;
roper[i].life=originalr[i].life;
roper[i].people=originalr[i].people;
roper[i].special=originalr[i].special;
roper[i].die=false;
}
}
void one_time_games() {
int numbers=getid()%nows+1;
int numberr=getid()%nowr+1;
nodes now_roles=ropes[numbers];
noder now_roler=roper[numberr];
int flagL_int_the_s=0;
for(int i=1; i<=nows; i++) {
if(ropes[i].die==false) {
if(ropes[i].special=='L') {
flagL_int_the_s++;
}
}
}
int flagL_int_the_r=0;
for(int i=1; i<=nowr; i++) {
if(roper[i].die==false) {
if(roper[i].special=='L') {
flagL_int_the_r++;
}
}
}
int flagC_int_the_s=0;
for(int i=1; i<=nows; i++) {
if(ropes[i].die==false) {
if(ropes[i].special=='C') {
flagC_int_the_s++;
}
}
}
int flagC_int_the_r=0;
for(int i=1; i<=nowr; i++) {
if(roper[i].die==false) {
if(roper[i].special=='C') {
flagC_int_the_r++;
}
}
}
for(int i=1; i<=nows; i++) {
if(ropes[i].die==false) {
if(ropes[i].people=='M') {
ropes[i].fight+=20*flagL_int_the_s;
}
}
}
for(int i=1; i<=nowr; i++) {
if(roper[i].die==false) {
if(roper[i].people=='M') {
roper[i].fight+=20*flagL_int_the_r;
}
}
}
if(now_roles.people=='P') {
now_roles.fight+=flagC_int_the_s*20;
now_roles.life+=flagC_int_the_s*20;
}
if(now_roler.people=='P') {
now_roler.fight+=flagC_int_the_r*20;
now_roler.life+=flagC_int_the_r*20;
}
now_roles.life-=now_roler.fight;
now_roler.life-=now_roles.fight;
if(now_roles.life<=0) {
if(now_roles.special=='K') {
for(int i=1; i<=nows; i++) {
if(ropes[i].die==false) {
if(ropes[i].people=='M') {
ropes[i].fight+=20;
ropes[i].life+=20;
}
}
}
}
if(now_roles.people=='P'){
for(int i=1; i<=nows; i++) {
if(ropes[i].die==false) {
if(ropes[i].special=='G') {
ropes[i].fight+=50;
}
}
}
}
ropes[numbers].die=true;
nows--;
} else {
ropes[numbers]=now_roles;
}
if(now_roler.life<=0) {
if(now_roler.special=='K') {
for(int i=1; i<=nowr; i++) {
if(roper[i].die==false) {
if(roper[i].people=='M') {
roper[i].fight+=20;
roper[i].life+=20;
}
}
}
}
if(now_roler.people=='P'){
for(int i=1; i<=nowr; i++) {
if(roper[i].die==false) {
if(roper[i].special=='G') {
roper[i].fight+=50;
}
}
}
}
roper[numberr].die=true;
nowr--;
} else {
roper[numberr]=now_roler;
}
}
void work() {
while(1) {
one_time_games();
if(nows==0) {
scorer++;
break;
} else if(nowr==0) {
scores++;
break;
}
}
}
void output(){
cout<<scores<<" "<<scorer<<endl;
}
signed main() {
freopen("chess.in","r",stdin);
freopen("chess.out","w",stdout);
ios::sync_with_stdio(false);
cin.tie(0),cout.tie(0);
cin>>n>>xx>>AA>>BB>>CC;
nows=nowr=n;
original_AA=AA;
original_BB=BB;
original_CC=CC;
for(int i=1; i<=n; i++) {
cin>>ropes[i].fight>>ropes[i].life>>ropes[i].people>>ropes[i].special;
// cout<<1<<endl;
originals[i].fight=ropes[i].fight;
originals[i].life=ropes[i].life;
originals[i].people=ropes[i].people;
originals[i].special=ropes[i].special;
}
for(int i=1; i<=n; i++) {
cin>>roper[i].fight>>roper[i].life>>roper[i].people>>roper[i].special;
originalr[i].fight=roper[i].fight;
originalr[i].life=roper[i].life;
originalr[i].people=roper[i].people;
originalr[i].special=roper[i].special;
}
for(int i=1; i<=500; i++) {
init();
work();
}
output();
return 0;
}