QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#362200#7786. Graft and TransplantSunlight9#WA 1ms3940kbC++141.1kb2024-03-23 14:33:442024-03-23 14:33:45

Judging History

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

  • [2024-03-23 14:33:45]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3940kb
  • [2024-03-23 14:33:44]
  • 提交

answer

#include<bits/stdc++.h>
#define int long long
#define rep(i,t,n) for (int i=t;i<=n;i++)
#define endl '\n'
using namespace std;

int n;
vector<vector<int> > ma(60, vector<int>(60, 0));

bool check(int u) {
	for (int i = 1; i <= n; ++i) {
		if (i == u) continue;
		if (!ma[i][u]) {
			return false;
		}
	}
	return true;
}

signed main(){
//	freopen("1.in","r",stdin);
//	freopen("1.out","w",stdout);
	ios::sync_with_stdio(false);
    cout.tie(0);cin.tie(0);

    cin >> n;
    for (int i = 1; i < n; ++i) {
    	int u, v;
    	cin >> u >> v;
    	ma[u][v] = ma[v][u] = 1;
	}
	
	for (int i = 1; i <= n; ++i) {
		if (check(i)) {
			cout << "Bob\n";
			return 0;
		}
	}
	
	for (int i = 1; i <= n; ++i) {
		for (int j = 1; j <= n; ++j) {
			if (i == j) continue;
			auto t = ma;
//			vector<int> q;
			for (int k = 1; k <= n; ++k) {
				if (k != j && ma[i][k]) {
					ma[i][k] = ma[k][i] = 0;
					ma[j][k] = ma[k][j] = 1;
				}
			}
			for (int k = 1; k <= n; ++k) {
				if (check(k)) {
					cout << "Alice\n";
					return 0;
				}
			}
			ma = t;
		}
	}
	
	cout << "Draw\n";
	
	return 0;
}


Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 3940kb

input:

4
1 2
2 3
3 4

output:

Alice

result:

ok "Alice"

Test #2:

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

input:

4
1 2
1 3
1 4

output:

Bob

result:

ok "Bob"

Test #3:

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

input:

2
1 2

output:

Bob

result:

ok "Bob"

Test #4:

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

input:

3
1 2
1 3

output:

Bob

result:

ok "Bob"

Test #5:

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

input:

5
2 1
2 3
3 4
1 5

output:

Draw

result:

wrong answer 1st words differ - expected: 'Bob', found: 'Draw'