QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#563191 | #9240. Mosaic | ModyKachef | 0 | 41ms | 11112kb | C++23 | 1.3kb | 2024-09-14 04:31:46 | 2024-09-14 04:31:46 |
Judging History
answer
#include "mosaic.h"
#include <bits/stdc++.h>
using namespace std;
#define int long long
#include <vector>
int solve(int x1 , int x2 , int y1 , int y2){
if (x1 == 0) x1++;
if (x2 == 0) x2++;
if (y1 == 0) y1++;
if (y2 == 0) y2++;
int h = x2 - x1 + 1 , w = y2 - y1 + 1;
//cout << h << ' ' << w << ' ' ;
int ans = 0;
if (h % 2 == 0 && w % 2 == 0) ans = (h * w) / 2;
else if (h % 2 == 0) ans = (h/2 * w);
else if (w % 2 == 0) ans = (w/2 * h);
else ans = ((w-1)/2 * h + (w + (x1)%2)/2);
//cout << ans << ' ';
//cout << '\n';
return ans;
}
std::vector<long long> mosaic(std::vector<signed> X, std::vector<signed> Y, std::vector<signed> T, std::vector<signed> B , std::vector<signed> L, std::vector<signed> R) {
int Q = T.size() , N = X.size();
vector<int> ans(Q);
int a[N][N] = {};
for (int j = 0 ; j < N ; j++){
a[0][j] = X[j];
}
for (int i = 0 ; i < N ; i++){
a[i][0] = Y[i];
}
for (int i = 1 ; i < N ; i++){
for (int j = 1 ; j < N ; j++){
a[i][j] = (!a[i-1][j] && !a[i][j-1]);
}
}
// for (int i = 0 ; i < N ; i++){
// for (int j = 0 ; j < N ; j++){
// cout << a[i][j];
// }
// cout << '\n';
// }
for (int i = 0 ; i < Q ; i++){
ans[i] = solve(T[i] , B[i] , L[i] , R[i]);
}
return ans;
}
詳細信息
Subtask #1:
score: 0
Wrong Answer
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3792kb
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 1 1 1 1 1 1 1 1 1 1
result:
wrong answer 3rd lines differ - on the 1st token, expected: '0', found: '1'
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: 41ms
memory: 11112kb
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 2 8 2 13 12 5 1 14 12 1 1 3 14 8 9 33 12 3 6 6 1 3 16 21 5 12 6 7 9 12 0 8 3 6 15 6 4 6 7 15 24 2 5 9 7 16 3 1 12 4 9 25 1 2 5 6 1 1 4 0 1 6 4 17 32 10 3 7 7 1 12 13 7 4 4 10 6 4 16 8 13 8 1 3 9 21 0 2 1 6 14 21 17 9 3 3 1 4 16 20 7 0 5 3 15 16 8 36 7 6 7 9 8 1...
result:
wrong answer 7th lines differ - on the 1st token, expected: '10', found: '13'
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%