QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#570313#9240. Mosaicliuziao0 31ms11556kbC++231.1kb2024-09-17 15:16:572024-09-17 15:17:05

Judging History

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

  • [2024-09-17 15:17:05]
  • 评测
  • 测评结果:0
  • 用时:31ms
  • 内存:11556kb
  • [2024-09-17 15:16:57]
  • 提交

answer

#include "mosaic.h"
#include <bits/stdc++.h>

const int kMaxN = 2e5 + 5;

int n, a[kMaxN], b[kMaxN];
int cnt[5005][5005];

void prework() {
  for (int i = 1; i <= n; ++i) {
    cnt[1][i] = a[i], cnt[i][1] = b[i];
  }
  for (int i = 2; i <= n; ++i)
    for (int j = 2; j <= n; ++j)
      cnt[i][j] = (!cnt[i - 1][j] && !cnt[i][j - 1]);
  for (int i = 1; i <= n; ++i)
    for (int j = 1; j <= n; ++j)
      cnt[i][j] += cnt[i][j - 1] + cnt[i - 1][j] - cnt[i - 1][j - 1];
}

int64_t query(int x, int y) {
  return cnt[x][y];
}

std::vector<long long> mosaic(std::vector<int> X, std::vector<int> Y,
                              std::vector<int> T, std::vector<int> B,
                              std::vector<int> L, std::vector<int> R) {
  n = (int)X.size();
  for (int i = 1; i <= n; ++i) {
    a[i] = X[i - 1], b[i] = Y[i - 1];
  }
  prework();
  std::vector<long long> vec;
  for (int i = 0; i < (int)T.size(); ++i) {
    vec.emplace_back(query(B[i] + 1, R[i] + 1) - query(T[i], R[i] + 1) - query(B[i] + 1, L[i]) + query(T[i], R[i]));
  }
  return vec;
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 0
Wrong Answer

Test #1:

score: 5
Accepted
time: 1ms
memory: 5884kb

input:

njJ9Z7VxxKGR6SUcJMgdzy3qMz4JZ1Tq
1
0
0
10
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0

output:

Wm5rkGNobnYjFI7TIY17RAm6FAQ2LlO9
OK
0
0
0
0
0
0
0
0
0
0

result:

ok 

Test #2:

score: 5
Accepted
time: 1ms
memory: 5876kb

input:

njJ9Z7VxxKGR6SUcJMgdzy3qMz4JZ1Tq
1
1
1
10
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0

output:

Wm5rkGNobnYjFI7TIY17RAm6FAQ2LlO9
OK
1
1
1
1
1
1
1
1
1
1

result:

ok 

Test #3:

score: 0
Wrong Answer
time: 0ms
memory: 3812kb

input:

njJ9Z7VxxKGR6SUcJMgdzy3qMz4JZ1Tq
2
1 0
1 0
10
1 1 0 1
1 1 0 1
0 0 0 0
0 1 0 1
0 1 0 1
1 1 0 0
0 1 0 1
0 1 1 1
1 1 0 1
0 0 0 1

output:

Wm5rkGNobnYjFI7TIY17RAm6FAQ2LlO9
OK
2
2
1
2
2
0
2
1
2
1

result:

wrong answer 3rd lines differ - on the 1st token, expected: '1', found: '2'

Subtask #2:

score: 0
Skipped

Dependency #1:

0%

Subtask #3:

score: 0
Runtime Error

Test #18:

score: 0
Runtime Error

input:

njJ9Z7VxxKGR6SUcJMgdzy3qMz4JZ1Tq
199999
0 1 0 1 1 1 1 1 1 1 1 0 1 1 1 1 1 0 0 0 1 0 0 0 0 1 1 1 0 1 0 0 0 1 0 1 1 0 1 1 1 0 1 0 0 1 1 0 1 1 0 0 0 1 1 0 0 0 0 0 0 1 1 1 1 1 1 0 0 0 0 0 0 0 1 0 1 1 1 1 1 0 0 0 1 0 0 0 0 1 0 0 0 1 1 1 1 0 1 0 1 1 1 0 1 0 1 0 0 0 1 1 1 1 0 0 0 1 1 1 1 0 1 0 1 1 0 0 0 0 ...

output:


result:


Subtask #4:

score: 0
Skipped

Dependency #2:

0%

Subtask #5:

score: 0
Wrong Answer

Test #31:

score: 0
Wrong Answer
time: 31ms
memory: 11556kb

input:

njJ9Z7VxxKGR6SUcJMgdzy3qMz4JZ1Tq
10
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
200000
1 7 0 4
3 4 3 4
3 6 2 5
4 5 6 7
5 7 2 8
0 6 4 7
0 5 6 7
1 3 9 9
6 9 1 7
2 9 4 6
4 4 6 7
0 1 8 8
7 7 0 3
0 4 1 7
2 2 0 9
3 9 4 6
3 9 0 9
1 8 4 6
4 5 5 7
0 6 2 3
2 3 0 6
1 9 8 8
2 4 3 4
3 6 2 9
3 9 2 7
1 3 0 3
0 8 2 4
3...

output:

Wm5rkGNobnYjFI7TIY17RAm6FAQ2LlO9
OK
14
3
11
3
22
12
5
2
29
13
2
0
8
14
8
12
40
12
6
6
9
4
4
23
26
5
12
9
8
13
12
3
9
3
19
19
9
13
6
12
15
35
4
6
13
12
18
3
4
13
9
9
31
5
2
7
8
4
1
22
4
3
10
13
18
32
10
8
8
7
5
16
11
7
4
5
18
10
25
16
8
21
8
3
7
12
27
1
2
3
14
17
21
14
24
10
3
2
4
16
20
8
3
5
3
19
23...

result:

wrong answer 4th lines differ - on the 1st token, expected: '2', found: '3'

Subtask #6:

score: 0
Runtime Error

Test #42:

score: 0
Runtime Error

input:

njJ9Z7VxxKGR6SUcJMgdzy3qMz4JZ1Tq
199999
0 1 0 0 0 0 1 1 0 1 1 1 1 1 1 1 1 1 1 1 0 0 1 1 0 0 0 1 1 0 1 0 1 1 0 0 1 0 1 0 1 0 1 0 1 0 0 1 0 1 0 1 1 0 0 1 1 1 1 1 0 1 1 0 0 0 0 0 0 1 1 1 1 1 1 1 1 0 0 1 0 1 0 1 1 0 0 0 1 0 1 0 0 1 1 1 1 0 0 1 1 1 1 0 1 0 0 0 0 0 1 1 1 0 1 1 0 1 1 0 0 1 1 0 0 0 0 1 0 1 ...

output:


result:


Subtask #7:

score: 0
Skipped

Dependency #3:

0%

Subtask #8:

score: 0
Skipped

Dependency #1:

0%