QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#560150 | #9240. Mosaic | chenxinyang2006# | 0 | 78ms | 28396kb | C++20 | 1.8kb | 2024-09-12 13:36:11 | 2024-09-12 13:36:11 |
Judging History
answer
#include "mosaic.h"
#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 uint unsigned int
#define ll long long
#define ull unsigned long long
#define db double
#define ldb long double
#define pii pair<int,int>
#define pll pair<ll,ll>
#define mkp make_pair
#define eb emplace_back
#define SZ(S) (int)S.size()
//#define mod 998244353
//#define mod 1000000007
#define inf 0x3f3f3f3f
#define linf 0x3f3f3f3f3f3f3f3f
using namespace std;
template <class T>
void chkmax(T &x,T y){
if(x < y) x = y;
}
template <class T>
void chkmin(T &x,T y){
if(x > y) x = y;
}
inline int popcnt(int x){
return __builtin_popcount(x);
}
inline int ctz(int x){
return __builtin_ctz(x);
}
vector <int> a[200005];
vector<ll> mosaic(vector<int> X, vector<int> Y,vector<int> U, std::vector<int> D,vector<int> L,vector<int> R) {
int n = SZ(X),q = SZ(U);
rep(i,1,q){
U[i]++;D[i]++;L[i]++;R[i]++;
}
rep(i,1,n){
if(i <= 4) a[i].resize(n + 1);
else a[i].resize(5);
}
rep(i,1,n){
a[1][i] = X[i - 1];
a[i][1] = Y[i - 1];
}
rep(i,2,n){
int up = 4;
if(i <= 4) up = n;
rep(j,2,up){
if(!a[i - 1][j] && !a[i][j - 1]) a[i][j] = 1;
else a[i][j] = 0;
}
}
vector <ll> ans(q);
rep(i,0,q - 1){
if(min(U[i],D[i]) <= 4){
ans[i] = a[U[i]][D[i]];
continue;
}
int rr = min((U[i] - 3) / 2,(D[i] - 3) / 2);
U[i] -= 2 * rr;D[i] -= 2 * rr;
assert(min(U[i],D[i]) <= 4 && max(U[i],D[i]) >= 1);
ans[i] = a[U[i]][D[i]];
}
return ans;
}
/*
g++ mosaic.cpp grader.cpp -o grader.exe -Wall -Wshadow -O2 -std=c++14
*/
Details
Tip: Click on the bar to expand more detailed information
Subtask #1:
score: 0
Runtime Error
Test #1:
score: 0
Runtime Error
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:
result:
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: 39ms
memory: 11116kb
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 0 0 0 1 0 0 1 0 0 1 0 1 0 1 1 1 0 0 0 0 1 1 0 1 1 0 1 1 1 0 1 1 0 0 0 1 0 0 1 0 0 0 1 1 1 0 0 1 0 1 0 1 1 0 1 0 1 0 1 1 1 1 0 0 0 1 1 1 1 0 1 0 1 0 1 0 1 1 0 0 1 0 1 0 1 0 1 0 0 0 0 0 1 1 1 0 1 0 0 1 1 1 0 0 0 0 0 0 0 1 0 0 0 1 1 0 0 1 0 0 0 0 0 0 0 0 1 1 0 1 0 ...
result:
wrong answer 3rd lines differ - on the 1st token, expected: '14', found: '0'
Subtask #6:
score: 0
Wrong Answer
Test #42:
score: 0
Wrong Answer
time: 78ms
memory: 28396kb
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:
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 4th lines differ - on the 1st token, expected: '1', found: '0'
Subtask #7:
score: 0
Skipped
Dependency #3:
0%
Subtask #8:
score: 0
Skipped
Dependency #1:
0%