QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#557272#8474. Matrices and SumswsyearAC ✓23ms7588kbC++231.0kb2024-09-11 08:34:142024-09-11 08:34:20

Judging History

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

  • [2024-09-11 08:34:20]
  • 评测
  • 测评结果:AC
  • 用时:23ms
  • 内存:7588kb
  • [2024-09-11 08:34:14]
  • 提交

answer

// Author: Klay Thompson
// Problem: H. Matrices and Sums
// Memory Limit: 1024 MB
// Time Limit: 1000 ms
// 
// Powered by CP Editor (https://cpeditor.org)

#include <bits/stdc++.h>

#define rep(i, j, k) for (int i = (j); i <= (k); ++i)
#define per(i, j, k) for (int i = (j); i >= (k); --i)
#define SZ(v) int((v).size())
#define ALL(v) (v).begin(),(v).end()
#define fi first
#define se second
using ll = long long;
using pii = std::pair<int, int>;
using pll = std::pair<ll, ll>;

template<class T>inline void chkmn(T &x, T y) { if (y < x) x = y; }
template<class T>inline void chkmx(T &x, T y) { if (y > x) x = y; }

using namespace std;

const int maxn = 1010;

int n, a[maxn][maxn];

int main() {
  cin.tie(nullptr) -> ios::sync_with_stdio(false);
  cin >> n;
  if (n & 1) return cout << "No\n", 0;
  cout << "Yes\n";
  rep (i, 1, n / 2) {
    rep (j, 1, n - i + 1) a[i][j] = -1;
  }
  rep (i, n / 2 + 1, n) {
    rep (j, n - i + 2, n) a[i][j] = 1;
  }
  rep (i, 1, n) rep (j, 1, n) cout << a[i][j] << " \n"[j == n];
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 3648kb

input:

2

output:

Yes
-1 -1
0 1

result:

ok OK, Accepted.

Test #2:

score: 0
Accepted
time: 0ms
memory: 3704kb

input:

1

output:

No

result:

ok OK, Accepted.

Test #3:

score: 0
Accepted
time: 0ms
memory: 3644kb

input:

3

output:

No

result:

ok OK, Accepted.

Test #4:

score: 0
Accepted
time: 0ms
memory: 3724kb

input:

4

output:

Yes
-1 -1 -1 -1
-1 -1 -1 0
0 0 1 1
0 1 1 1

result:

ok OK, Accepted.

Test #5:

score: 0
Accepted
time: 0ms
memory: 3620kb

input:

5

output:

No

result:

ok OK, Accepted.

Test #6:

score: 0
Accepted
time: 0ms
memory: 3608kb

input:

6

output:

Yes
-1 -1 -1 -1 -1 -1
-1 -1 -1 -1 -1 0
-1 -1 -1 -1 0 0
0 0 0 1 1 1
0 0 1 1 1 1
0 1 1 1 1 1

result:

ok OK, Accepted.

Test #7:

score: 0
Accepted
time: 0ms
memory: 3636kb

input:

7

output:

No

result:

ok OK, Accepted.

Test #8:

score: 0
Accepted
time: 0ms
memory: 3720kb

input:

8

output:

Yes
-1 -1 -1 -1 -1 -1 -1 -1
-1 -1 -1 -1 -1 -1 -1 0
-1 -1 -1 -1 -1 -1 0 0
-1 -1 -1 -1 -1 0 0 0
0 0 0 0 1 1 1 1
0 0 0 1 1 1 1 1
0 0 1 1 1 1 1 1
0 1 1 1 1 1 1 1

result:

ok OK, Accepted.

Test #9:

score: 0
Accepted
time: 0ms
memory: 3580kb

input:

9

output:

No

result:

ok OK, Accepted.

Test #10:

score: 0
Accepted
time: 0ms
memory: 3616kb

input:

10

output:

Yes
-1 -1 -1 -1 -1 -1 -1 -1 -1 -1
-1 -1 -1 -1 -1 -1 -1 -1 -1 0
-1 -1 -1 -1 -1 -1 -1 -1 0 0
-1 -1 -1 -1 -1 -1 -1 0 0 0
-1 -1 -1 -1 -1 -1 0 0 0 0
0 0 0 0 0 1 1 1 1 1
0 0 0 0 1 1 1 1 1 1
0 0 0 1 1 1 1 1 1 1
0 0 1 1 1 1 1 1 1 1
0 1 1 1 1 1 1 1 1 1

result:

ok OK, Accepted.

Test #11:

score: 0
Accepted
time: 0ms
memory: 3572kb

input:

21

output:

No

result:

ok OK, Accepted.

Test #12:

score: 0
Accepted
time: 0ms
memory: 3576kb

input:

37

output:

No

result:

ok OK, Accepted.

Test #13:

score: 0
Accepted
time: 0ms
memory: 3632kb

input:

73

output:

No

result:

ok OK, Accepted.

Test #14:

score: 0
Accepted
time: 1ms
memory: 3908kb

input:

100

output:

Yes
-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1...

result:

ok OK, Accepted.

Test #15:

score: 0
Accepted
time: 0ms
memory: 3556kb

input:

233

output:

No

result:

ok OK, Accepted.

Test #16:

score: 0
Accepted
time: 0ms
memory: 3560kb

input:

555

output:

No

result:

ok OK, Accepted.

Test #17:

score: 0
Accepted
time: 14ms
memory: 7588kb

input:

666

output:

Yes
-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1...

result:

ok OK, Accepted.

Test #18:

score: 0
Accepted
time: 17ms
memory: 7060kb

input:

888

output:

Yes
-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1...

result:

ok OK, Accepted.

Test #19:

score: 0
Accepted
time: 0ms
memory: 3628kb

input:

999

output:

No

result:

ok OK, Accepted.

Test #20:

score: 0
Accepted
time: 23ms
memory: 7580kb

input:

1000

output:

Yes
-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1...

result:

ok OK, Accepted.