跳到正文

题解

题解:P12063 [THUPC 2025 决赛] 我的围棋

AnotherDream约 2 分钟
原文
文章信息与版本

文章信息

发布
2025年4月8日
收录
2025年12月12日
更新
2026年11月13日
篇幅
约 2 分钟
题目
P12063

版本

  1. v1当前

P12063 题解

题意简述

这不是神之一手吗。

让我们比比柯洁和卞相壹哪个人的棋盒盖先被塞爆。

思路

每次提子判断当前盒盖是否已经被塞爆,如果被塞爆了,判断当前是谁提子,然后输出,结束程序。如果到最后没有退出就是平局。

代码

C++
#include <bits/stdc++.h>
using namespace std;
#define debug cerr<<"The code runs successfully.\n";
#define endl '\n'
#define TRACE 1
#define tcout TRACE && cout
#define fst ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define int long long
const int P = 998244353; 
const int Base = 33331;
const int INF = 0x3f3f3f3f3f3f3f3f; 
const int N = 1e6 + 10, M = 2e6 + 10;
int a[2],n,m;//a[0]代表白棋盒盖,a[1]相反
signed main() {
	fst;
	cin>>n>>m;
	for(int i=1;i<=n;i++) {
		int x;
		cin>>x;
		a[i&1]+=x;
		if(a[i&1]>m) {//当前盒盖被塞满
			if(i&1) cout<<"White\n";//黑棋盒盖被塞满,黑棋输,白棋赢
			else cout<<"Black\n";//相反
			return 0;//胜负已定
		}
	}
	cout<<"Draw\n";//平局的情况
	return 0;
}
原文