Analysis
給定兩種操作:
- Select an edge of GGG and delete it from GGG.删一條邊
- Select a connected component of GGG which doesn’t have any loop, then delete it from GGG.删一個連通塊
那麼對于第一種操作, 會使得邊數 − 1 -1 −1,對于第二種操作, 會使得點數 − k -k −k, 邊數 − ( k − 1 ) -(k-1) −(k−1)。
任何一種操作都會使得點數+邊數的和( n + m n + m n+m)減少一個奇數( 1 o r 2 k − 1 1\ or\ 2k-1 1 or 2k−1),是以判斷 n + m n + m n+m的奇偶性輸出即可。
Analysis
#include <bits/stdc++.h>
using namespace std;
signed main(){
int n, m, a, b; cin >> n >> m;
if((n + m) % 2 == 0) cout << "Bob" << endl;
else cout << "Alice" << endl;
}