第二次参加东北四省赛,赛前还是有点紧张。
反而队友表现的比较淡定。可能是我太重视了吧,呵呵。
吉大很大很美。
赛前几分钟入场。读题。按照平时的顺序来读。
刷新一下榜,A题过了一片了,我问zr能做吗,他说没看懂题 =_= 好吧我看了下,水水水。。一个图,n个点,1~n,任意两个点之间的边长为lcm(u,v),求最小生成树。
直接1连每个点就好了2+3+...+n=(2+n)*(n-1)/2。1Y
再刷一下榜,C题过了一片,ys打了个表,说直接输出这两个数就好了,1Y
再刷一下榜,E题过了一片,我读,写完了zr说写的不对,我俩讨论下题意,我改。。。然后交了两发,都wa了,又让ys读题,mdzz果然读错了。。。是说三条首尾相连的线,并不是线的长度是3。3Y
#include <iostream> #include <algorithm> #include <cstring> #include <cstdio> #include <cmath> #include <queue> #include <map> #include <vector> #include <string> using namespace std; int a[50][50]; int n, m; bool ok(int x, int y) { if (x < n && x >= 0 && y < m && y >= 0) return true; return false; } int main(){ //freopen("in.txt","r",stdin); int T, cas = 0; scanf("%d", &T); while (T--) { cout << "Case #" << ++cas << ": "; scanf("%d%d", &n, &m); for (int i = 0; i < n; ++i) { for (int j = 0; j < m; ++j) { scanf("%d", &a[i][j]); } } bool fg = false; for (int i = 0; i < n; ++i) { for (int j = 0; j < m; ++j) { if (ok(i, j+1) && a[i][j] == a[i][j+1]) fg = true; if (ok(i+1, j) && a[i][j] == a[i+1][j]) fg = true; } } for (int i = 0; i < m; ++i) { for (int j = i+1; j < m; ++j) { if (a[0][i] == a[0][j] || a[n-1][i] == a[n-1][j]) fg = true; } } for (int i = 0; i < n; ++i) { for (int j = i+1; j < n; ++j) { if (a[i][0] == a[j][0] || a[i][m-1] == a[j][m-1]) fg = true; } } if (fg) printf("Yes\n"); else printf("No\n"); } return 0; }