【Codeforces Round #420 (Div. 2) A】Okabe and Future Gadget Laboratory
and Codeforces div round Future
2023-09-14 09:03:50 时间
【题目链接】:http://codeforces.com/contest/821/problem/A
【题意】
给你一个n*n的数组;
然后问你,是不是每个位置(x,y);
都能找到一个同一行的元素q和同一列的元素w;
使得q+w=a[x][y]
【题解】
【Number Of WA】
0
【反思】
不用考虑会选到a[x][y]本身.
【完整代码】
#include <bits/stdc++.h>
using namespace std;
#define lson l,m,rt<<1
#define rson m+1,r,rt<<1|1
#define LL long long
#define rep1(i,a,b) for (int i = a;i <= b;i++)
#define rep2(i,a,b) for (int i = a;i >= b;i--)
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define ms(x,y) memset(x,y,sizeof x)
#define Open() freopen("F:\\rush.txt","r",stdin)
#define Close() ios::sync_with_stdio(0)
typedef pair<int,int> pii;
typedef pair<LL,LL> pll;
const int dx[9] = {0,1,-1,0,0,-1,-1,1,1};
const int dy[9] = {0,0,0,-1,1,-1,1,-1,1};
const double pi = acos(-1.0);
const int N = 50;
int a[N+10][N+10],n;
void out(){
cout <<"No"<<endl;
exit(0);
}
int main(){
//Open();
Close();
cin >> n;
rep1(i,1,n){
rep1(j,1,n){
cin >> a[i][j];
}
}
rep1(i,1,n){
rep1(j,1,n){
if (a[i][j]!=1){
int fi = 0;
rep1(ii,1,n)
rep1(jj,1,n)
if (a[ii][j]+a[i][jj]==a[i][j])
fi = 1;
if (!fi) out();
}
}
}
cout <<"Yes"<<endl;
return 0;
}
相关文章
- CodeForces 750A New Year and Hurry
- A. Vova and Train ( Codeforces Round #515 (Div. 3) )
- ORA-32425: asynchronous and scheduled purge option is not allowed on commit SCN-based materialized view log ORACLE 报错 故障修复 远程处理
- ORA-02204: ALTER, INDEX and EXECUTE not allowed for views ORACLE 报错 故障修复 远程处理
- ORA-02757: osnfop: fork_and_bind failed ORACLE 报错 故障修复 远程处理
- Codeforces 842B Gleb And Pizza几何,水详解编程语言
- hardLinux: A Journey of Hard Work and Dedication(linuxwork)
- 多条件查询MySQL中使用And多条件查询的步骤(mysql中and)
- 条件MySQL 子句之间`AND`操作符多条件查询(mysql多个and)
- Mastering the Art of Linux with MK: A Comprehensive Guide for Beginners and Pros(linuxmk)
- Exploring the Benefits of Using Linux and Pysvn for Effective Software Development(linuxpysvn)
- Mastering Linux Operating System Administration: Tips Tricks and Best Practices(linux操作系统管理)
- Exploring the World of Linux UTC: Understanding Its Importance and Functionality(linuxutc)
- 深入探究Mysql中IN与AND逻辑运算的应用(mysql中in与and)
- MySQL中的AND逻辑操作符是什么(mysql中and是什么)
- and的区别Oracle数据库中的OR与AND的差异(oracle中or和)