답안 #299328

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
299328 2020-09-14T17:48:51 Z arayi Vision Program (IOI19_vision) C++17
73 / 100
16 ms 1912 KB
#include "vision.h"
#include <bits/stdc++.h>
#define ad push_back
using namespace std;

const int N = 250;
int n, m, i1;
int tox[N], col[N];
int l1, r1, l2, r2;
int mk, zro;
int ka[N], ka1[N];
void construct_network(int H, int W, int k)
{
	n = H, m = W;
	for (int i = 0; i < n; i++)
	{
	    vector <int> p;
	    for (int j = 0; j < m; j++)
            p.ad(i * m + j);
        if(i) p.ad(tox[i - 1]);
        tox[i] = add_xor(p);
    }
    for (int i = 0; i < m; i++)
    {
        vector <int> p;
        for(int j = 0; j < n; j++)
            p.ad(j * m + i);
        if(i) p.ad(col[i - 1]);
        col[i] = add_xor(p);
    }
    i1 = col[m - 1] + 1;
    int l;
    l = 3;
    for (int i = 0; i < n; i++)
    {
        vector <int> p;
        if(i == 0)
        {
            p.ad(tox[i]);
            add_or(p);
            p.clear(), p.ad(tox[n - 1]);
            for(int j = 0; j < l - 1; j++) add_or(p);
            i1 += l;
        }
        else
        {
            p.ad(tox[i]);
            add_or(p);
            p.clear();
            i1++;
            for(int j = 0; j < l - 1; j++)
            {
                p.clear();
                p.ad(i1 - 1);
                p.ad(i1 - l - 1);
                add_and(p);
                i1++;
            }
            for(int j = 0; j < l; j++)
            {
                p.clear();
                p.ad(i1 - l);
                p.ad(i1 - l * 2);
                add_xor(p);
                i1++;
            }
            p.clear();
            p.ad(col[m - 1]);
            if(i == (1 << l) - 3) add_or(p), l++, i1++;
        }
        if(i == n - 1)
        {
            l1 = i1 - l;
            r1 = i1 - 1;
        }
    }
    l = 3;
    for (int i = 0; i < m; i++)
    {
        vector <int> p;
        if(i == 0)
        {
            p.ad(col[i]);
            add_or(p);
            p.clear(), p.ad(col[m - 1]);
            for(int j = 0; j < l - 1; j++) add_or(p);
            i1 += l;
        }
        else
        {
            //cout << i1 << endl;
            p.clear();
            p.ad(col[i]);
            add_or(p);
            i1++;
            for(int j = 0; j < l - 1; j++)
            {
                p.clear();
                p.ad(i1 - 1);
                p.ad(i1 - l - 1);
                add_and(p);
                i1++;
            }
            for(int j = 0; j < l; j++)
            {
                p.clear();
                p.ad(i1 - l);
                p.ad(i1 - l * 2);
                add_xor(p);
                i1++;
            }

            p.clear();
            p.ad(col[m - 1]);
            if(i == (1 << l) - 3) add_or(p), l++, i1++;
        }
        if(i == m - 1)
        {
            l2 = i1 - l;
            r2 = i1 - 1;
        }
    }
    //cout << l1 << " " << r1 << " " << l2 << " " << r2 << endl;
    vector <int> p;
    zro = col[m - 1];
    for (int i = 0; i < n; i++) p.ad(tox[i]);
    for (int i = 0; i < m; i++) p.ad(col[i]);
    mk = add_or(p);
    i1 = mk + 1;
    l = 3;
    for (int i = 0; i < n; i++) if(i == (1 << l) - 3) l++;
    for (int i = 0; i < n; i++)
    {
        //if(i == (1 << l) - 3) l++;
        for(int j = 0; j < l; j++)
        {
            p.clear();
            p.ad(l1 + j);
            if(i & (1 << j)) p.ad(mk);
            else p.ad(zro);
            add_xor(p);
            i1++;
        }
        p.clear();
        for(int j = 0; j < l; j++)
            p.ad(i1 - j - 1);
        add_or(p);
        i1++;
        ka[i] = add_not(i1 - 1);
        i1++;
    }
    l = 3;
    for (int i = 0; i < m; i++) if(i == (1 << l) - 3) l++;
    for (int i = 0; i < m; i++)
    {
        //if(i == (1 << l) - 3) l++;
        for(int j = 0; j < l; j++)
        {
            p.clear();
            p.ad(l2 + j);
            if(i & (1 << j)) p.ad(mk);
            else p.ad(zro);
            add_xor(p);
            i1++;
        }
        p.clear();
        for(int j = 0; j < l; j++)
            p.ad(i1 - j - 1);
        add_or(p);
        i1++;
        ka1[i] = add_not(i1 - 1);
        i1++;
    }
    int ii = -1;
    for (int i = 0; i <= k; i++)
    {
        if(n <= i || k - i >= m) continue;
        if(ii == -1) ii = i1;
        p.clear();
        p.ad(ka[i]);
        p.ad(ka1[k - i]);
        add_and(p);
        i1++;
    }
    p.clear();
    for (int i = ii; i < i1; i++)
        p.ad(i);
    add_or(p);
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 256 KB Output is correct
2 Correct 0 ms 256 KB Output is correct
3 Correct 1 ms 256 KB Output is correct
4 Correct 1 ms 288 KB Output is correct
5 Correct 1 ms 256 KB Output is correct
6 Correct 1 ms 256 KB Output is correct
7 Correct 1 ms 256 KB Output is correct
8 Correct 0 ms 256 KB Output is correct
9 Correct 1 ms 256 KB Output is correct
10 Correct 1 ms 256 KB Output is correct
11 Correct 1 ms 256 KB Output is correct
12 Correct 1 ms 256 KB Output is correct
13 Correct 1 ms 256 KB Output is correct
14 Correct 1 ms 256 KB Output is correct
15 Correct 1 ms 256 KB Output is correct
16 Correct 1 ms 256 KB Output is correct
17 Correct 1 ms 256 KB Output is correct
18 Correct 1 ms 256 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 256 KB Output is correct
2 Correct 0 ms 256 KB Output is correct
3 Correct 1 ms 256 KB Output is correct
4 Correct 1 ms 288 KB Output is correct
5 Correct 1 ms 256 KB Output is correct
6 Correct 1 ms 256 KB Output is correct
7 Correct 1 ms 256 KB Output is correct
8 Correct 0 ms 256 KB Output is correct
9 Correct 1 ms 256 KB Output is correct
10 Correct 1 ms 256 KB Output is correct
11 Correct 1 ms 256 KB Output is correct
12 Correct 1 ms 256 KB Output is correct
13 Correct 1 ms 256 KB Output is correct
14 Correct 1 ms 256 KB Output is correct
15 Correct 1 ms 256 KB Output is correct
16 Correct 1 ms 256 KB Output is correct
17 Correct 1 ms 256 KB Output is correct
18 Correct 1 ms 256 KB Output is correct
19 Correct 1 ms 384 KB Output is correct
20 Correct 1 ms 384 KB Output is correct
21 Correct 1 ms 384 KB Output is correct
22 Correct 1 ms 384 KB Output is correct
23 Correct 1 ms 384 KB Output is correct
24 Correct 1 ms 384 KB Output is correct
25 Correct 1 ms 384 KB Output is correct
26 Correct 1 ms 384 KB Output is correct
27 Correct 1 ms 384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 256 KB Output is correct
2 Correct 0 ms 256 KB Output is correct
3 Correct 1 ms 256 KB Output is correct
4 Correct 1 ms 288 KB Output is correct
5 Correct 1 ms 256 KB Output is correct
6 Correct 1 ms 256 KB Output is correct
7 Correct 1 ms 256 KB Output is correct
8 Correct 0 ms 256 KB Output is correct
9 Correct 1 ms 256 KB Output is correct
10 Correct 1 ms 256 KB Output is correct
11 Correct 1 ms 256 KB Output is correct
12 Correct 1 ms 256 KB Output is correct
13 Correct 1 ms 256 KB Output is correct
14 Correct 1 ms 256 KB Output is correct
15 Correct 1 ms 256 KB Output is correct
16 Correct 1 ms 256 KB Output is correct
17 Correct 1 ms 256 KB Output is correct
18 Correct 1 ms 256 KB Output is correct
19 Correct 1 ms 384 KB Output is correct
20 Correct 1 ms 384 KB Output is correct
21 Correct 1 ms 384 KB Output is correct
22 Correct 1 ms 384 KB Output is correct
23 Correct 1 ms 384 KB Output is correct
24 Correct 1 ms 384 KB Output is correct
25 Correct 1 ms 384 KB Output is correct
26 Correct 1 ms 384 KB Output is correct
27 Correct 1 ms 384 KB Output is correct
28 Correct 1 ms 384 KB Output is correct
29 Correct 1 ms 384 KB Output is correct
30 Correct 1 ms 384 KB Output is correct
31 Correct 1 ms 384 KB Output is correct
32 Correct 1 ms 384 KB Output is correct
33 Correct 1 ms 384 KB Output is correct
34 Correct 1 ms 384 KB Output is correct
35 Correct 1 ms 384 KB Output is correct
36 Correct 1 ms 384 KB Output is correct
37 Correct 1 ms 512 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 256 KB Output is correct
2 Correct 0 ms 256 KB Output is correct
3 Correct 1 ms 256 KB Output is correct
4 Correct 1 ms 288 KB Output is correct
5 Correct 1 ms 256 KB Output is correct
6 Correct 1 ms 256 KB Output is correct
7 Correct 1 ms 256 KB Output is correct
8 Correct 0 ms 256 KB Output is correct
9 Correct 1 ms 256 KB Output is correct
10 Correct 1 ms 256 KB Output is correct
11 Correct 1 ms 256 KB Output is correct
12 Correct 1 ms 256 KB Output is correct
13 Correct 1 ms 256 KB Output is correct
14 Correct 1 ms 256 KB Output is correct
15 Correct 1 ms 256 KB Output is correct
16 Correct 1 ms 256 KB Output is correct
17 Correct 1 ms 256 KB Output is correct
18 Correct 1 ms 256 KB Output is correct
19 Correct 1 ms 384 KB Output is correct
20 Correct 1 ms 384 KB Output is correct
21 Correct 1 ms 384 KB Output is correct
22 Correct 1 ms 384 KB Output is correct
23 Correct 1 ms 384 KB Output is correct
24 Correct 1 ms 384 KB Output is correct
25 Correct 1 ms 384 KB Output is correct
26 Correct 1 ms 384 KB Output is correct
27 Correct 1 ms 384 KB Output is correct
28 Correct 1 ms 384 KB Output is correct
29 Correct 1 ms 384 KB Output is correct
30 Correct 1 ms 384 KB Output is correct
31 Correct 1 ms 384 KB Output is correct
32 Correct 1 ms 384 KB Output is correct
33 Correct 1 ms 384 KB Output is correct
34 Correct 1 ms 384 KB Output is correct
35 Correct 1 ms 384 KB Output is correct
36 Correct 1 ms 384 KB Output is correct
37 Correct 1 ms 512 KB Output is correct
38 Correct 6 ms 1024 KB Output is correct
39 Correct 2 ms 512 KB Output is correct
40 Correct 2 ms 512 KB Output is correct
41 Correct 4 ms 768 KB Output is correct
42 Correct 5 ms 768 KB Output is correct
43 Correct 6 ms 1024 KB Output is correct
44 Correct 6 ms 1024 KB Output is correct
45 Correct 6 ms 1024 KB Output is correct
46 Correct 6 ms 1024 KB Output is correct
47 Correct 6 ms 1024 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 768 KB Output is correct
2 Correct 4 ms 768 KB Output is correct
3 Correct 4 ms 768 KB Output is correct
4 Correct 4 ms 768 KB Output is correct
5 Correct 4 ms 768 KB Output is correct
6 Correct 5 ms 768 KB Output is correct
7 Correct 6 ms 768 KB Output is correct
8 Correct 4 ms 768 KB Output is correct
9 Correct 4 ms 768 KB Output is correct
10 Correct 4 ms 768 KB Output is correct
11 Correct 4 ms 768 KB Output is correct
12 Correct 4 ms 768 KB Output is correct
13 Correct 4 ms 768 KB Output is correct
14 Correct 5 ms 768 KB Output is correct
15 Correct 4 ms 768 KB Output is correct
16 Correct 4 ms 768 KB Output is correct
17 Correct 4 ms 768 KB Output is correct
18 Correct 4 ms 768 KB Output is correct
19 Correct 4 ms 768 KB Output is correct
20 Correct 4 ms 768 KB Output is correct
21 Correct 1 ms 256 KB Output is correct
22 Correct 1 ms 256 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 256 KB Output is correct
2 Correct 1 ms 256 KB Output is correct
3 Correct 3 ms 640 KB Output is correct
4 Correct 3 ms 640 KB Output is correct
5 Correct 3 ms 640 KB Output is correct
6 Correct 4 ms 672 KB Output is correct
7 Correct 4 ms 640 KB Output is correct
8 Correct 5 ms 768 KB Output is correct
9 Correct 5 ms 800 KB Output is correct
10 Correct 4 ms 768 KB Output is correct
11 Correct 4 ms 768 KB Output is correct
12 Correct 5 ms 800 KB Output is correct
13 Correct 5 ms 768 KB Output is correct
14 Correct 4 ms 768 KB Output is correct
15 Correct 4 ms 768 KB Output is correct
16 Correct 4 ms 768 KB Output is correct
17 Correct 4 ms 768 KB Output is correct
18 Correct 4 ms 672 KB Output is correct
19 Correct 4 ms 768 KB Output is correct
20 Correct 10 ms 1276 KB Output is correct
21 Correct 10 ms 1276 KB Output is correct
22 Correct 10 ms 1308 KB Output is correct
23 Correct 10 ms 1276 KB Output is correct
24 Correct 10 ms 1276 KB Output is correct
25 Correct 10 ms 1276 KB Output is correct
26 Correct 10 ms 1276 KB Output is correct
27 Correct 16 ms 1912 KB Output is correct
28 Correct 16 ms 1912 KB Output is correct
29 Incorrect 3 ms 1404 KB WA in grader: Too many instructions
30 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 16 ms 1912 KB Output is correct
2 Correct 1 ms 256 KB Output is correct
3 Correct 3 ms 768 KB Output is correct
4 Correct 4 ms 768 KB Output is correct
5 Correct 4 ms 768 KB Output is correct
6 Correct 4 ms 768 KB Output is correct
7 Correct 10 ms 1276 KB Output is correct
8 Correct 10 ms 1276 KB Output is correct
9 Correct 16 ms 1912 KB Output is correct
10 Correct 1 ms 256 KB Output is correct
11 Correct 1 ms 384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 256 KB Output is correct
2 Correct 0 ms 256 KB Output is correct
3 Correct 1 ms 256 KB Output is correct
4 Correct 1 ms 288 KB Output is correct
5 Correct 1 ms 256 KB Output is correct
6 Correct 1 ms 256 KB Output is correct
7 Correct 1 ms 256 KB Output is correct
8 Correct 0 ms 256 KB Output is correct
9 Correct 1 ms 256 KB Output is correct
10 Correct 1 ms 256 KB Output is correct
11 Correct 1 ms 256 KB Output is correct
12 Correct 1 ms 256 KB Output is correct
13 Correct 1 ms 256 KB Output is correct
14 Correct 1 ms 256 KB Output is correct
15 Correct 1 ms 256 KB Output is correct
16 Correct 1 ms 256 KB Output is correct
17 Correct 1 ms 256 KB Output is correct
18 Correct 1 ms 256 KB Output is correct
19 Correct 1 ms 384 KB Output is correct
20 Correct 1 ms 384 KB Output is correct
21 Correct 1 ms 384 KB Output is correct
22 Correct 1 ms 384 KB Output is correct
23 Correct 1 ms 384 KB Output is correct
24 Correct 1 ms 384 KB Output is correct
25 Correct 1 ms 384 KB Output is correct
26 Correct 1 ms 384 KB Output is correct
27 Correct 1 ms 384 KB Output is correct
28 Correct 1 ms 384 KB Output is correct
29 Correct 1 ms 384 KB Output is correct
30 Correct 1 ms 384 KB Output is correct
31 Correct 1 ms 384 KB Output is correct
32 Correct 1 ms 384 KB Output is correct
33 Correct 1 ms 384 KB Output is correct
34 Correct 1 ms 384 KB Output is correct
35 Correct 1 ms 384 KB Output is correct
36 Correct 1 ms 384 KB Output is correct
37 Correct 1 ms 512 KB Output is correct
38 Correct 6 ms 1024 KB Output is correct
39 Correct 2 ms 512 KB Output is correct
40 Correct 2 ms 512 KB Output is correct
41 Correct 4 ms 768 KB Output is correct
42 Correct 5 ms 768 KB Output is correct
43 Correct 6 ms 1024 KB Output is correct
44 Correct 6 ms 1024 KB Output is correct
45 Correct 6 ms 1024 KB Output is correct
46 Correct 6 ms 1024 KB Output is correct
47 Correct 6 ms 1024 KB Output is correct
48 Correct 4 ms 768 KB Output is correct
49 Correct 4 ms 768 KB Output is correct
50 Correct 4 ms 768 KB Output is correct
51 Correct 4 ms 768 KB Output is correct
52 Correct 4 ms 768 KB Output is correct
53 Correct 5 ms 768 KB Output is correct
54 Correct 6 ms 768 KB Output is correct
55 Correct 4 ms 768 KB Output is correct
56 Correct 4 ms 768 KB Output is correct
57 Correct 4 ms 768 KB Output is correct
58 Correct 4 ms 768 KB Output is correct
59 Correct 4 ms 768 KB Output is correct
60 Correct 4 ms 768 KB Output is correct
61 Correct 5 ms 768 KB Output is correct
62 Correct 4 ms 768 KB Output is correct
63 Correct 4 ms 768 KB Output is correct
64 Correct 4 ms 768 KB Output is correct
65 Correct 4 ms 768 KB Output is correct
66 Correct 4 ms 768 KB Output is correct
67 Correct 4 ms 768 KB Output is correct
68 Correct 1 ms 256 KB Output is correct
69 Correct 1 ms 256 KB Output is correct
70 Correct 1 ms 256 KB Output is correct
71 Correct 1 ms 256 KB Output is correct
72 Correct 3 ms 640 KB Output is correct
73 Correct 3 ms 640 KB Output is correct
74 Correct 3 ms 640 KB Output is correct
75 Correct 4 ms 672 KB Output is correct
76 Correct 4 ms 640 KB Output is correct
77 Correct 5 ms 768 KB Output is correct
78 Correct 5 ms 800 KB Output is correct
79 Correct 4 ms 768 KB Output is correct
80 Correct 4 ms 768 KB Output is correct
81 Correct 5 ms 800 KB Output is correct
82 Correct 5 ms 768 KB Output is correct
83 Correct 4 ms 768 KB Output is correct
84 Correct 4 ms 768 KB Output is correct
85 Correct 4 ms 768 KB Output is correct
86 Correct 4 ms 768 KB Output is correct
87 Correct 4 ms 672 KB Output is correct
88 Correct 4 ms 768 KB Output is correct
89 Correct 10 ms 1276 KB Output is correct
90 Correct 10 ms 1276 KB Output is correct
91 Correct 10 ms 1308 KB Output is correct
92 Correct 10 ms 1276 KB Output is correct
93 Correct 10 ms 1276 KB Output is correct
94 Correct 10 ms 1276 KB Output is correct
95 Correct 10 ms 1276 KB Output is correct
96 Correct 16 ms 1912 KB Output is correct
97 Correct 16 ms 1912 KB Output is correct
98 Incorrect 3 ms 1404 KB WA in grader: Too many instructions
99 Halted 0 ms 0 KB -