QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#384960#3767. 奇矩阵wanyurukongAC ✓53ms3592kbC++17873b2024-04-10 14:10:222024-04-10 14:10:23

Judging History

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

  • [2024-04-10 14:10:23]
  • 评测
  • 测评结果:AC
  • 用时:53ms
  • 内存:3592kb
  • [2024-04-10 14:10:22]
  • 提交

answer

#include <bits/stdc++.h>

using namespace std;
#define fi first
#define se second
#define int long long
typedef pair<int, int> PII;
const int mod = 1e9 + 7;
const int N = 1e6 + 10;
int r[N];
void solve() 
{
    int n,m;
    while(cin>>n>>m)
    {
        int f1=-1;
        int f0=-1;
        for(int i=0;i<n;i++)
        {
            int f=0;
            for(int j=0;j<m;j++)
            {
                int a;
                cin>>a;
                f+=a;
            }
            if(f%2==1&&f1==-1)f1=1;
            else if(f%2==0&&f0==-1)f0=1;
        }
        if(n>=3)cout<<"No\n";
        else if(n==1)cout<<"Yes\n";
        else if(f0==1&&f1==1)cout<<"Yes\n";
        else cout<<"No\n";
    }
}


signed main() 
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int _;
    _ = 1;
    // cin >> _;
    while (_--) {
        solve();
    }
}

詳細信息

Test #1:

score: 100
Accepted
time: 53ms
memory: 3592kb

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