답안 #727654

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
727654 2023-04-21T05:15:25 Z PixelCat Vision Program (IOI19_vision) C++14
58 / 100
88 ms 9068 KB
#include "vision.h"
#ifdef NYAOWO
#include "grader.cpp"
#endif
 
#include <bits/stdc++.h>
#define For(i, a, b) for(int i = a; i <= b; i++)
#define Forr(i,a, b) for(int i = a; i >= b; i--)
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define sz(x) ((int)x.size())
#define eb emplace_back
// #define int LL
using namespace std;
using LL = long long;
using pii = pair<int, int>;
 
const int MAXN = 410;

int get_xor(int *x, int l, int r) {
    if(l == 0) return x[r];
    return add_xor({x[r], x[l - 1]});
}

vector<vector<int>> dia1; // x + y, [0, H + W - 2]
vector<vector<int>> dia2; // x - y + W - 1, [0, H + W - 2]
int xor1[MAXN], xor2[MAXN];

int check(int k) {
    int n = sz(dia1);
 
    vector<int> v;
    For(i, 0, n - k - 1) {
        vector<int> q;
        For(j, 0, k) q.insert(q.end(), all(dia1[i + j]));
        // or = 1, xor = 0  =>  2 black cells
        v.eb(add_xor({add_or(q), get_xor(xor1, i, i + k)}));
    }
    int a = add_or(v);
 
    v.clear();
    For(i, 0, n - k - 1) {
        vector<int> q;
        For(j, 0, k) q.insert(q.end(), all(dia2[i + j]));
        // or = 1, xor = 0  =>  2 black cells
        v.eb(add_xor({add_or(q), get_xor(xor2, i, i + k)}));
    }
    int b = add_or(v);
 
    return add_and({a, b});
}
 
void construct_network(int H, int W, int K) {
    // std::vector<int> Ns;
    // Ns = {0, 1};
    // int a = add_and(Ns);
    // Ns = {0, a};
    // int b = add_or(Ns);
    // Ns = {0, 1, b};
    // int c = add_xor(Ns);
    // add_not(c);
    int n = H + W - 1;
    dia1.resize(n);
    dia2.resize(n);
    For(i, 0, H - 1) For(j, 0, W - 1) {
        int id = i * W + j;
        dia1[i + j].eb(id);
        dia2[i - j + W - 1].eb(id);
    }

    xor1[0] = add_xor(dia1[0]);
    xor2[0] = add_xor(dia2[0]);
    For(i, 1, n - 1) {
        dia1[i].eb(xor1[i - 1]);
        xor1[i] = add_xor(dia1[i]);
        dia1[i].pop_back();
        
        dia2[i].eb(xor2[i - 1]);
        xor2[i] = add_xor(dia2[i]);
        dia2[i].pop_back();
    }

    int a = check(K);
    int b = check(K - 1);
    b = add_not(b);
    add_and({a, b});
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 304 KB Output is correct
5 Correct 1 ms 300 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 1 ms 300 KB Output is correct
12 Correct 1 ms 212 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 1 ms 212 KB Output is correct
15 Correct 1 ms 212 KB Output is correct
16 Correct 1 ms 304 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Correct 1 ms 308 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 304 KB Output is correct
5 Correct 1 ms 300 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 1 ms 300 KB Output is correct
12 Correct 1 ms 212 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 1 ms 212 KB Output is correct
15 Correct 1 ms 212 KB Output is correct
16 Correct 1 ms 304 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Correct 1 ms 308 KB Output is correct
19 Correct 1 ms 212 KB Output is correct
20 Correct 1 ms 340 KB Output is correct
21 Correct 1 ms 212 KB Output is correct
22 Correct 1 ms 212 KB Output is correct
23 Correct 1 ms 212 KB Output is correct
24 Correct 1 ms 340 KB Output is correct
25 Correct 1 ms 308 KB Output is correct
26 Correct 1 ms 212 KB Output is correct
27 Correct 1 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 304 KB Output is correct
5 Correct 1 ms 300 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 1 ms 300 KB Output is correct
12 Correct 1 ms 212 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 1 ms 212 KB Output is correct
15 Correct 1 ms 212 KB Output is correct
16 Correct 1 ms 304 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Correct 1 ms 308 KB Output is correct
19 Correct 1 ms 212 KB Output is correct
20 Correct 1 ms 340 KB Output is correct
21 Correct 1 ms 212 KB Output is correct
22 Correct 1 ms 212 KB Output is correct
23 Correct 1 ms 212 KB Output is correct
24 Correct 1 ms 340 KB Output is correct
25 Correct 1 ms 308 KB Output is correct
26 Correct 1 ms 212 KB Output is correct
27 Correct 1 ms 212 KB Output is correct
28 Correct 6 ms 692 KB Output is correct
29 Correct 1 ms 212 KB Output is correct
30 Correct 1 ms 340 KB Output is correct
31 Correct 1 ms 340 KB Output is correct
32 Correct 1 ms 340 KB Output is correct
33 Correct 2 ms 428 KB Output is correct
34 Correct 6 ms 724 KB Output is correct
35 Correct 7 ms 944 KB Output is correct
36 Correct 5 ms 724 KB Output is correct
37 Correct 2 ms 340 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 304 KB Output is correct
5 Correct 1 ms 300 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 1 ms 300 KB Output is correct
12 Correct 1 ms 212 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 1 ms 212 KB Output is correct
15 Correct 1 ms 212 KB Output is correct
16 Correct 1 ms 304 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Correct 1 ms 308 KB Output is correct
19 Correct 1 ms 212 KB Output is correct
20 Correct 1 ms 340 KB Output is correct
21 Correct 1 ms 212 KB Output is correct
22 Correct 1 ms 212 KB Output is correct
23 Correct 1 ms 212 KB Output is correct
24 Correct 1 ms 340 KB Output is correct
25 Correct 1 ms 308 KB Output is correct
26 Correct 1 ms 212 KB Output is correct
27 Correct 1 ms 212 KB Output is correct
28 Correct 6 ms 692 KB Output is correct
29 Correct 1 ms 212 KB Output is correct
30 Correct 1 ms 340 KB Output is correct
31 Correct 1 ms 340 KB Output is correct
32 Correct 1 ms 340 KB Output is correct
33 Correct 2 ms 428 KB Output is correct
34 Correct 6 ms 724 KB Output is correct
35 Correct 7 ms 944 KB Output is correct
36 Correct 5 ms 724 KB Output is correct
37 Correct 2 ms 340 KB Output is correct
38 Incorrect 4 ms 4528 KB WA in grader: Too many inputs
39 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 556 KB Output is correct
2 Correct 5 ms 724 KB Output is correct
3 Correct 5 ms 688 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 2 ms 596 KB Output is correct
6 Correct 6 ms 724 KB Output is correct
7 Correct 5 ms 644 KB Output is correct
8 Correct 1 ms 340 KB Output is correct
9 Correct 2 ms 468 KB Output is correct
10 Correct 5 ms 724 KB Output is correct
11 Correct 5 ms 724 KB Output is correct
12 Correct 6 ms 724 KB Output is correct
13 Correct 4 ms 596 KB Output is correct
14 Correct 1 ms 340 KB Output is correct
15 Correct 2 ms 468 KB Output is correct
16 Correct 5 ms 688 KB Output is correct
17 Correct 6 ms 724 KB Output is correct
18 Correct 5 ms 724 KB Output is correct
19 Correct 4 ms 596 KB Output is correct
20 Correct 1 ms 304 KB Output is correct
21 Correct 1 ms 212 KB Output is correct
22 Correct 1 ms 304 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 300 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 4 ms 596 KB Output is correct
4 Correct 32 ms 3316 KB Output is correct
5 Correct 45 ms 4420 KB Output is correct
6 Correct 33 ms 3404 KB Output is correct
7 Correct 3 ms 596 KB Output is correct
8 Correct 6 ms 936 KB Output is correct
9 Correct 88 ms 9068 KB Output is correct
10 Incorrect 4 ms 4564 KB WA in grader: Too many inputs
11 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 32 ms 4276 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 4 ms 596 KB Output is correct
4 Correct 7 ms 940 KB Output is correct
5 Correct 2 ms 468 KB Output is correct
6 Correct 2 ms 576 KB Output is correct
7 Correct 18 ms 2384 KB Output is correct
8 Correct 17 ms 2276 KB Output is correct
9 Correct 35 ms 4396 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 304 KB Output is correct
5 Correct 1 ms 300 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 1 ms 300 KB Output is correct
12 Correct 1 ms 212 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 1 ms 212 KB Output is correct
15 Correct 1 ms 212 KB Output is correct
16 Correct 1 ms 304 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Correct 1 ms 308 KB Output is correct
19 Correct 1 ms 212 KB Output is correct
20 Correct 1 ms 340 KB Output is correct
21 Correct 1 ms 212 KB Output is correct
22 Correct 1 ms 212 KB Output is correct
23 Correct 1 ms 212 KB Output is correct
24 Correct 1 ms 340 KB Output is correct
25 Correct 1 ms 308 KB Output is correct
26 Correct 1 ms 212 KB Output is correct
27 Correct 1 ms 212 KB Output is correct
28 Correct 6 ms 692 KB Output is correct
29 Correct 1 ms 212 KB Output is correct
30 Correct 1 ms 340 KB Output is correct
31 Correct 1 ms 340 KB Output is correct
32 Correct 1 ms 340 KB Output is correct
33 Correct 2 ms 428 KB Output is correct
34 Correct 6 ms 724 KB Output is correct
35 Correct 7 ms 944 KB Output is correct
36 Correct 5 ms 724 KB Output is correct
37 Correct 2 ms 340 KB Output is correct
38 Incorrect 4 ms 4528 KB WA in grader: Too many inputs
39 Halted 0 ms 0 KB -