QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#398285#3767. 奇矩阵xlwang#AC ✓11ms7560kbC++141.4kb2024-04-25 10:22:202024-04-25 10:22:20

Judging History

你现在查看的是最新测评结果

  • [2024-04-25 10:22:20]
  • 评测
  • 测评结果:AC
  • 用时:11ms
  • 内存:7560kb
  • [2024-04-25 10:22:20]
  • 提交

answer

#include<bits/stdc++.h>
#define fr(i,j,k) for(register int i=j;i<=k;++i)
#define rf(i,j,k) for(register int i=j;i>=k;--i)
#define foredge(i,j) for(register int i=head[j];i;i=e[i].nxt)
#define pb push_back
#define Times printf("Time:%.3lf\n",clock()/CLOCKS_PER_SEC)
using namespace std;
inline int read(){
	int x=0;
	bool f=0;
	char c=getchar();
	while(!isdigit(c)) f|=(c=='-'),c=getchar();
	while(isdigit(c)) x=(x<<3)+(x<<1)+(c^48),c=getchar();
	return f?-x:x;
}
inline void write(int x){
    if(x<0){putchar('-');x=-x;}
    if(x>9)write(x/10);
    putchar(x%10+'0');
}
inline void writeln(int x){write(x); puts("");}
inline void writepl(int x){write(x); putchar(' ');}
mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
inline int randfind(int l,int r){return rnd()%(r-l+1)+l;}
//inline void init(){
//	int t=read();
//	while(t--) work();
//}
int n,m;
const int Maxn=1e3+10;
int a[Maxn][Maxn];
inline void work(){
    fr(i,1,n) fr(j,1,m) a[i][j]=read();
    if(n>=3){
        puts("No");
        return;
    }
    if(n==1){
        puts("Yes");
        return;
    }
    int s=0;
    fr(i,1,m) s=(s+abs(a[1][i]-a[2][i]))%2;
    if(s&1) puts("Yes");
    else puts("No");
}
inline void init(){
    while(cin>>n>>m) work();
}
signed main(){
	// freopen("input.in","r",stdin);
	// freopen("output.out","w",stdout);
    init();
    // printf("\nTIME:%.3lf",(double)clock()/CLOCKS_PER_SEC);
	return 0;
}

詳細信息

Test #1:

score: 100
Accepted
time: 11ms
memory: 7560kb

input:

1 2
0 0
2 3
1 2 3
2 1 4
3 3
1 2 3
4 5 6
7 8 9
1 1000
8 9 1 7 4 2 0 5 3 7 8 3 4 7 2 3 0 1 7 5 2 8 0 4 9 2 0 9 6 8 3 5 2 6 0 2 6 0 9 3 4 8 5 4 2 2 4 4 6 7 8 1 1 8 0 7 2 0 3 2 6 1 9 1 5 0 0 5 6 7 3 6 1 0 8 2 5 7 0 7 3 8 6 3 1 5 2 1 8 4 1 0 1 2 3 3 6 3 5 6 7 0 7 7 3 2 0 9 9 1 6 0 1 6 3 7 6 3 6 7 4 3 7 7...

output:

Yes
Yes
No
Yes
No
No
Yes
No
Yes
Yes
No
Yes
No
Yes
Yes
Yes
Yes
No
No
No
Yes
Yes
Yes
No
No
No
Yes
Yes
Yes
Yes
Yes
Yes
No
No
No
Yes
Yes
No
Yes
Yes
Yes
Yes
No
Yes
Yes
No
Yes
Yes
Yes
No
No
Yes
No
No
Yes
Yes
Yes
Yes
No
No
Yes
No
No
No
No
No
Yes
Yes
No
Yes
No
No
Yes
Yes
Yes
Yes
No
Yes
No
Yes
Yes
No
Yes
No
...

result:

ok 257 lines