标签:map number plain oar xpl short into UI names
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)
Total Submission(s): 1273 Accepted Submission(s): 625
#include <iostream> #include <cstring> #include <cstdio> #include <algorithm> #include <queue> #include <vector> #include <iomanip> #include <math.h> #include <map> using namespace std; #define FIN freopen("input.txt","r",stdin); #define FOUT freopen("output.txt","w",stdout); #define INF 0x3f3f3f3f #define INFLL 0x3f3f3f3f3f3f3f #define lson l,m,rt<<1 #define rson m+1,r,rt<<1|1 typedef long long LL; typedef pair<int, int> PII; using namespace std; int mp[35][35]; int flag = 0; int n, m; void dfs(int x, int y, int num) { if(flag) return ; if(x == 1 || x == n) { for(int i = 1; i <= m; i++) { if(i == y) continue; if(mp[x][i] == num) flag = 1; } } if(y == 1 || y == m) { for(int i = 1; i <= n; i++) { if(i == x) continue; if(mp[i][y] == num) flag = 1; } } if(mp[x + 1][y] == num || mp[x - 1][y] == num || mp[x][y + 1] == num || mp[x][y - 1] == num) flag = 1; } int main() { //FIN int T; int cnt = 1; scanf("%d", &T); while(T--) { scanf("%d%d", &n, &m); memset(mp, -1, sizeof(mp)); for(int i = 1; i <= n; i++) { for(int j = 1; j <= m; j++) { scanf("%d", &mp[i][j]); } } flag = 0; for(int i = 1; i<= n; i++) { for(int j = 1; j <= m; j++) { dfs(i, j, mp[i][j]); } } if(flag) printf("Case #%d: Yes\n", cnt++); else printf("Case #%d: No\n", cnt++); } return 0; }
HDU 5926 Basic Mr. Frog’s Game 瞎搞
标签:map number plain oar xpl short into UI names
原文地址:http://www.cnblogs.com/Hyouka/p/7351259.html