QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#557261 | #9240. Mosaic | yyyyxh# | 0 | 184ms | 61068kb | C++14 | 1.2kb | 2024-09-11 08:30:24 | 2024-09-11 08:30:24 |
Judging History
answer
#include "mosaic.h"
#include <vector>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
vl mosaic(vi X,vi Y,vi T,vi B,vi L,vi R) {
const int D=20;
int n=max(X.size(),Y.size()),q=max(L.size(),R.size());
vector<vi> adj(2*n-1);
for(int i=0;i<2*n;++i) adj[i].reserve(D+1);
auto A=[&](int i,int j)->int&{
int p=i-j+n-1,d=min(i,j);
while(d>=(int)adj[p].size()) adj[p].emplace_back(0);
return adj[p][d];
};
for(int i=0;i<n;++i)
for(int j=0;j<n;++j){
if(i>D&&j>D) break;
if(!i||!j){
if(!i) A(i,j)=X[j];
if(!j) A(i,j)=Y[i];
continue;
}
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){
if(i>=D&&j>=D) break;
if(i) A(i,j)+=A(i-1,j);
if(j) A(i,j)+=A(i,j-1);
}
auto qry=[&](int x,int y)->ll{
if(x<0||y<0) return 0;
if(x>=D&&y>=D){
ll ans=A(x,D-1)+A(D-1,y)-A(D-1,D-1);
for(int i=D;i<=y;++i) // (D,i)
if(A(D,i)) ans+=min(x-D,y-i)+1;
for(int i=D+1;i<=x;++i) // (i,D)
if(A(i,D)) ans+=min(x-i,y-D)+1;
return ans;
}
else return A(x,y);
};
vl res(q);
for(int o=0;o<q;++o){
--T[o];--L[o];
res[o]=qry(B[o],R[o])+qry(T[o],L[o])-qry(T[o],R[o])-qry(B[o],R[o]);
}
return res;
}
详细
Subtask #1:
score: 0
Wrong Answer
Test #1:
score: 5
Accepted
time: 0ms
memory: 3800kb
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: 0
Wrong Answer
time: 0ms
memory: 3820kb
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 0 0 0 0 0 0 0 0 0 0
result:
wrong answer 3rd lines differ - on the 1st token, expected: '1', found: '0'
Subtask #2:
score: 0
Skipped
Dependency #1:
0%
Subtask #3:
score: 0
Wrong Answer
Test #18:
score: 0
Wrong Answer
time: 184ms
memory: 61068kb
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:
Wm5rkGNobnYjFI7TIY17RAm6FAQ2LlO9 OK 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 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 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 0 0 0 0 0 0 0 0 0 0 0 0 ...
result:
wrong answer 3rd lines differ - on the 1st token, expected: '1314', found: '0'
Subtask #4:
score: 0
Skipped
Dependency #2:
0%
Subtask #5:
score: 0
Wrong Answer
Test #31:
score: 0
Wrong Answer
time: 38ms
memory: 11080kb
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 0 -5 -10 -35 -272 0 0 0 -442 -1 -35 0 -46 0 -5 -10 -29 0 -47 0 -3 0 -1 -28 -18 0 0 -12 -3 -11 0 -1 -3 0 -258 -11 -18 -1559 0 -19 0 -90 -211 -9 -8 -62 -2 0 0 -2 -853 0 -29 -2879 -3 -5 -11 0 -717 -716 0 0 -29 -117 0 0 0 -243 -3 0 0 -4 0 -1 0 -2 -255 -29 -2784 0 0 -7...
result:
wrong answer 3rd lines differ - on the 1st token, expected: '14', found: '0'
Subtask #6:
score: 0
Time Limit Exceeded
Test #42:
score: 0
Time Limit Exceeded
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%