QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#398331#3767. 奇矩阵SamponYW#AC ✓56ms7904kbC++141.5kb2024-04-25 10:54:422024-04-25 10:54:43

Judging History

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

  • [2024-04-25 10:54:43]
  • 评测
  • 测评结果:AC
  • 用时:56ms
  • 内存:7904kb
  • [2024-04-25 10:54:42]
  • 提交

answer

#include <bits/stdc++.h>
#define db double
#define il inline
#define re register
#define ll long long
#define ui unsigned
#define ull ui ll
#define i128 __int128
#define pii pair<int, int>
#define fi first
#define se second
#define eb emplace_back
#define SZ(v) (int)v.size()
#define ALL(v) v.begin(), v.end()
#define mems(v, x) memset(v, x, sizeof(v))
#define memc(a, b) memcpy(a, b, sizeof(a))
#define FOR(i, L, R) for(re int i = (L); i <= (R); ++i)
#define ROF(i, R, L) for(re int i = (R); i >= (L); --i)
#define LS i << 1, l, mid
#define RS i << 1 | 1, mid + 1, r
#define popc(x) __builtin_popcount(x)
#define popcll(x) __builtin_popcountll(x)
using namespace std;
#define N 1005
#define P 1000000007
il int add(int x, int y) {return x + y < P ? x + y : x + y - P;}
il void addr(int &x, int y) {(x += y) >= P && (x -= P);}
il int qpow(int p, int n = P - 2) {
  int s = 1;
  while(n) {
    if(n & 1) s = 1ll * s * p % P;
    p = 1ll * p * p % P, n >>= 1;
  }
  return s;
}
const int mu = qpow(1e4);
const int B = 64;
int n, m, v[N][N];
il void WORK() {
  FOR(i, 1, n) FOR(j, 1, m) cin >> v[i][j];
  if(n > 2) {cout << "No\n"; return ;}
  FOR(i, 1, n) {
    FOR(j, i + 1, n) {
      int s = 0;
      FOR(k, 1, m) s += abs(v[i][k] - v[j][k]);
      if(!(s & 1)) {cout << "No\n"; return ;}
    }
  }
  cout << "Yes\n";
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0), cout.tie(0);
  while(cin >> n >> m) WORK();
  cerr << 1.0 * clock() / CLOCKS_PER_SEC;
  return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 56ms
memory: 7904kb

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