图博弈
http://codeforces.com/gym/100889/problem/E
题意:给出n个点m条有向边,有向简单图,问jorah能否走到n节点,对手可以移除任意一边。
解法:只有jorah一步走到n节点才可能赢。
#include<cstdio> #include<cmath> #include<map> #include<cstring> #include <iostream> #include<algorithm> using namespace std; const int MAX = 1e5 + 10; typedef long long LL; LL a[100009]; int main() { int t ; cin >> t ; while(t--) { int n , m , flag = 0 ; cin >> n >> m ; for(int i = 0 ; i < m ; i++) { int u , v ; scanf("%d%d" , &u , &v); if(u == 1 && v == n) flag = 1 ; } if(flag) cout << "Jorah Mormont" << endl ; else cout << "Khal Drogo" << endl ; } return 0; }