QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#367588#2364. Endgamekevinyang#WA 1ms3824kbC++171.1kb2024-03-26 09:08:512024-03-26 09:08:52

Judging History

你现在查看的是最新测评结果

  • [2024-03-26 09:08:52]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3824kb
  • [2024-03-26 09:08:51]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
#define int long long
mt19937_64 rng(std::chrono::system_clock::now().time_since_epoch().count());

bool solve(int a, int b, int c, int d, vector<int>&x, vector<int>&y){
	int n = x.size();
	// can (a,b) move two moves to capture (c,d)
	map<pair<int,int>,int>hm;

	for(int i = 0; i<n; i++){
		hm[{a+x[i],b+y[i]}] = 1;
	}
	if(hm.count({c,d}))return true;
	for(int i = 0; i<n; i++){
		if(hm.count({c-x[i],d-y[i]})){
			return true;
		}
	}
	return false;
}
signed main(){
	cin.tie(nullptr)->sync_with_stdio(false);
	int n;
	cin >> n;
	vector<int>x(n);
	vector<int>y(n);
	int a,b,c,d;
	cin >> a >> b >> c >> d;
	for(int i = 0; i<n; i++){
		cin >> x[i] >> y[i];
	}
	if(solve(a,b,c,d,x,y)){
		cout << "Alice wins\n";
		return 0;
	}
	for(int iters = 0; iters<30; iters++){
		int ax = c; int ay = d;
		while(ax == c && ay == d){
			ax = rng()%n+1;
			ay = rng()%n+1;
		}
		if(solve(c,d,ax,ay,x,y)){
			continue;
		}
		cout << "tie " << ax << ' ' << ay << endl;
		return 0;
	}
	cout << "Bob wins\n";
	return 0;
}

详细

Test #1:

score: 100
Accepted
time: 1ms
memory: 3592kb

input:

3
2 3
1 3
1 0
0 -1
1 -1

output:

Bob wins

result:

ok 

Test #2:

score: 0
Accepted
time: 0ms
memory: 3824kb

input:

3
3 3
1 1
1 0
1 1
0 1

output:

Bob wins

result:

ok 

Test #3:

score: 0
Accepted
time: 1ms
memory: 3544kb

input:

3
2 2
3 1
-1 0
-1 1
0 1

output:

Bob wins

result:

ok 

Test #4:

score: -100
Wrong Answer
time: 1ms
memory: 3616kb

input:

5
2 1
1 2
-2 2
1 -1
1 1
2 2
3 3

output:

Alice wins

result:

wrong answer Author claims 'alice', but judge claims 'tie'