tjut 5924
来源:互联网 发布:csgo loss网络优化 编辑:程序博客网 时间:2024/05/18 02:36
#include <stdio.h> #include <string.h> #include <iostream> #include <algorithm> #include <stack> #include <vector> #include <queue> #include <set> #include <map> #include <string> #include <math.h> #include <stdlib.h> #include <time.h> using namespace std; #define showtime fprintf(stderr,"time = %.15f\n",clock() / (double)CLOCKS_PER_SEC) #define lld %I64d #define REP(i,k,n) for(int i=k;i<n;i++) #define REPP(i,k,n) for(int i=k;i<=n;i++) #define scan(d) scanf("%d",&d) #define scanl(d) scanf("%I64d",&d) #define scann(n,m) scanf("%d%d",&n,&m) #define scannl(n,m) scanf("%I64d%I64d",&n,&m) #define mst(a,k) memset(a,k,sizeof(a)) #define LL long long #define N 1005 #define mod 1000000007 inline int read(){int s=0;char ch=getchar();for(; ch<'0'||ch>'9'; ch=getchar());for(; ch>='0'&&ch<='9'; ch=getchar())s=s*10+ch-'0';return s;} int a[33][33]; int n,m; bool slove() { REP(i,0,n) for(int j=0;j<m-1;j++) if(a[i][j] == a[i][j+1]) return 1; REP(j,0,m) for(int i=0;i<n-1;i++) if(a[i][j] == a[i+1][j]) return 1; REP(i,0,n) for(int j=i+1;j<m;j++) if(a[0][i]==a[0][j] || a[n-1][i]==a[n-1][j]) return 1; REP(i,0,m) for(int j=i+1;j<n;j++) if(a[i][0]==a[j][0] || a[i][m-1]==a[j][m-1]) return 1; return 0; } int main() { //freopen("in.txt","r",stdin); //freopen("out.txt","w",stdout); int t,cas=1; scan(t); while(t--) { scann(n,m); REP(i,0,n) REP(j,0,m) scan(a[i][j]); if(slove()) printf("Case #%d: Yes\n",cas++); else printf("Case #%d: No\n",cas++); } return 0; }
0 0
- tjut 5924
- tjut 5924
- tjut 5289
- tjut 5288
- tjut 5294
- tjut 2586
- tjut 5296
- tjut 5297
- tjut 5299
- tjut 5384
- tjut 5387
- tjut 5386
- tjut 5381
- tjut 5400
- tjut 5399
- tjut 5396
- tjut 5398
- tjut 5412
- android控件之CheckBox
- 关于编程中浮点数精度的问题
- 【转载】Python Unicode与中文处理
- 文章标题
- hue 集成 hive问题
- tjut 5924
- 用pypiserver搭建个人的pypi源
- 关于Intent
- XXE xml实体注入
- QT mouseMoveEvent事件(qmainwindow内追踪鼠标事件事件)
- void*解读
- 分布式文件系统:原理、问题与方法
- 简单分页存储管理的一些粗浅的总结
- 11.3