QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#560157#9240. Mosaicchenxinyang2006#22 77ms28364kbC++201.9kb2024-09-12 13:42:592024-09-12 13:42:59

Judging History

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

  • [2024-09-12 13:42:59]
  • 评测
  • 测评结果:22
  • 用时:77ms
  • 内存:28364kb
  • [2024-09-12 13:42:59]
  • 提交

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,0,q - 1){
        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 = min(n,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;
        }
//        rep(j,2,up) cerr << a[i][j] << " ";
//        cerr << endl;
    }
    vector <ll> ans(q);
    rep(i,0,q - 1){
        if(min(U[i],L[i]) <= 4){
            ans[i] = a[U[i]][L[i]];
            continue;
        }
        int rr = min((U[i] - 3) / 2,(L[i] - 3) / 2);
        U[i] -= 2 * rr;L[i] -= 2 * rr;
        assert(min(U[i],L[i]) <= 4 && max(U[i],L[i]) >= 1);
        ans[i] = a[U[i]][L[i]];
    }
    return ans;
}
/*
g++ mosaic.cpp grader2.cpp -o grader.exe -Wall -Wshadow -O2 -std=c++14
*/

详细

Subtask #1:

score: 0
Wrong Answer

Test #1:

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

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: 0ms
memory: 4064kb

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: 1ms
memory: 3760kb

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
0
0
1
1
1
0
1
0
0
1

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: 60ms
memory: 28152kb

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
1
0
1
1
1
0
1
0
1
0
0
1
0
1
0
1
1
1
1
0
0
1
0
0
0
1
0
0
1
0
1
0
1
1
0
1
0
1
1
0
0
0
1
0
1
0
0
1
0
0
1
1
0
0
0
0
0
1
1
1
0
0
1
0
1
0
0
0
0
0
1
1
1
0
0
0
1
0
0
1
1
1
0
1
0
1
0
1
1
1
1
0
1
1
1
0
1
1
0
1
0
1
1
0
1
0
0
1
1
0
1
0
1
0
0
1
0
1
1
0
0
1
1
1
1
0
0
0
1
0
1
0
...

result:

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

Subtask #4:

score: 0
Skipped

Dependency #2:

0%

Subtask #5:

score: 0
Wrong Answer

Test #31:

score: 0
Wrong Answer
time: 36ms
memory: 11056kb

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
1
0
1
0
0
0
1
0
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
1
0
0
0
0
0
0
0
1
0
1
0
0
0
1
1
1
0
1
0
0
0
0
1
0
1
0
1
0
0
0
1
0
1
1
0
0
1
1
1
0
0
0
0
1
1
0
0
1
0
0
0
1
0
1
0
1
0
0
0
0
0
0
0
1
1
1
1
1
0
0
0
0
1
0
0
0
1
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
1
...

result:

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

Subtask #6:

score: 22
Accepted

Test #42:

score: 22
Accepted
time: 76ms
memory: 28164kb

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
1
0
1
0
1
0
0
1
1
1
1
0
1
0
1
1
1
0
0
1
1
1
0
0
1
0
0
0
1
0
0
1
0
1
0
1
1
1
1
1
0
1
0
0
0
0
1
1
0
1
0
0
0
1
0
0
0
0
1
0
1
0
0
0
0
1
0
0
0
0
1
0
1
0
1
0
0
0
1
0
0
1
0
0
0
0
0
1
0
1
0
0
1
0
1
1
0
1
1
1
1
1
0
0
1
0
0
1
0
0
1
0
0
0
0
0
1
1
1
0
1
1
1
0
1
0
1
0
1
0
1
...

result:

ok 

Test #43:

score: 22
Accepted
time: 77ms
memory: 28344kb

input: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0
0
1
0
0
0
1
1
0
1
0
1
1
0
1
1
1
0
1
0
0
1
0
0
0
0
0
0
0
0
0
1
0
0
1
1
1
1
1
0
0
0
0
0
0
1
1
1
1
0
1
0
1
0
1
1
0
1
1
1
0
1
0
0
0
...

result:

ok 

Test #48:

score: 22
Accepted
time: 61ms
memory: 15756kb

input:

njJ9Z7VxxKGR6SUcJMgdzy3qMz4JZ1Tq
56938
1 1 1 0 0 0 0 0 0 0 0 1 1 0 0 0 1 1 1 0 0 1 0 0 0 1 0 0 0 1 1 0 1 0 1 0 1 0 1 1 1 0 0 1 1 1 0 0 1 0 1 0 0 0 0 1 0 0 0 1 1 0 0 0 0 1 0 0 0 1 1 1 0 0 0 0 1 1 1 1 0 0 0 1 1 1 0 0 0 1 0 1 0 1 0 0 1 1 1 1 1 1 0 0 1 0 1 1 1 0 0 1 0 0 0 0 1 0 0 1 0 1 1 0 1 1 1 0 0 1 0...

output:

Wm5rkGNobnYjFI7TIY17RAm6FAQ2LlO9
OK
1
1
1
0
0
1
1
0
1
0
0
0
0
0
0
1
0
0
0
1
0
0
0
1
1
1
0
0
0
0
0
1
0
1
1
1
1
0
0
1
1
0
0
0
0
1
0
1
0
0
1
0
1
1
1
0
0
0
0
1
0
1
1
0
1
0
0
0
0
0
1
0
1
0
0
0
0
0
0
0
1
1
1
1
1
0
1
1
1
1
1
0
0
0
0
0
0
0
1
0
0
1
1
0
1
1
1
1
1
0
0
1
1
1
1
1
0
1
0
1
1
1
1
0
1
0
0
0
1
0
1
0
...

result:

ok 

Subtask #7:

score: 0
Skipped

Dependency #3:

0%

Subtask #8:

score: 0
Skipped

Dependency #1:

0%