답안 #299299

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
299299 2020-09-14T16:37:58 Z arayi Vision Program (IOI19_vision) C++17
55 / 100
21 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;
    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 < 6; j++) add_or(p);
            i1 += 7;
        }
        else
        {
            p.ad(tox[i]);
            add_or(p);
            p.clear();
            i1++;
            for(int j = 0; j < 6; j++)
            {
                p.clear();
                p.ad(i1 - 1);
                p.ad(i1 - 8);
                add_and(p);
                i1++;
            }
            for(int j = 0; j < 7; j++)
            {
                p.clear();
                p.ad(i1 - 7);
                p.ad(i1 - 14);
                add_xor(p);
                i1++;
            }
        }
        if(i == n - 1)
        {
            l1 = i1 - 7;
            r1 = i1 - 1;
        }
    }
    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 < 6; j++) add_or(p);
            i1 += 7;
        }
        else
        {
            //cout << i1 << endl;
            p.clear();
            p.ad(col[i]);
            add_or(p);
            i1++;
            for(int j = 0; j < 6; j++)
            {
                p.clear();
                p.ad(i1 - 1);
                p.ad(i1 - 8);
                add_and(p);
                i1++;
            }
            for(int j = 0; j < 7; j++)
            {
                p.clear();
                p.ad(i1 - 7);
                p.ad(i1 - 14);
                add_xor(p);
                i1++;
            }
        }
        if(i == m - 1)
        {
            l2 = i1 - 7;
            r2 = i1 - 1;
        }
    }
    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;
    for (int i = 0; i < n; i++)
    {
        for(int j = 0; j < 7; 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 < 7; j++)
            p.ad(i1 - j - 1);
        add_or(p);
        i1++;
        ka[i] = add_not(i1 - 1);
        i1++;
    }
    for (int i = 0; i < m; i++)
    {
        for(int j = 0; j < 7; 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 < 7; 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 1 ms 384 KB Output is correct
2 Correct 1 ms 256 KB Output is correct
3 Correct 1 ms 384 KB Output is correct
4 Correct 1 ms 256 KB Output is correct
5 Correct 1 ms 256 KB Output is correct
6 Correct 1 ms 384 KB Output is correct
7 Correct 1 ms 256 KB Output is correct
8 Correct 1 ms 384 KB Output is correct
9 Correct 1 ms 256 KB Output is correct
10 Correct 1 ms 384 KB Output is correct
11 Correct 1 ms 384 KB Output is correct
12 Correct 1 ms 384 KB Output is correct
13 Correct 1 ms 384 KB Output is correct
14 Correct 1 ms 384 KB Output is correct
15 Correct 1 ms 384 KB Output is correct
16 Correct 1 ms 384 KB Output is correct
17 Correct 1 ms 256 KB Output is correct
18 Correct 1 ms 416 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 384 KB Output is correct
2 Correct 1 ms 256 KB Output is correct
3 Correct 1 ms 384 KB Output is correct
4 Correct 1 ms 256 KB Output is correct
5 Correct 1 ms 256 KB Output is correct
6 Correct 1 ms 384 KB Output is correct
7 Correct 1 ms 256 KB Output is correct
8 Correct 1 ms 384 KB Output is correct
9 Correct 1 ms 256 KB Output is correct
10 Correct 1 ms 384 KB Output is correct
11 Correct 1 ms 384 KB Output is correct
12 Correct 1 ms 384 KB Output is correct
13 Correct 1 ms 384 KB Output is correct
14 Correct 1 ms 384 KB Output is correct
15 Correct 1 ms 384 KB Output is correct
16 Correct 1 ms 384 KB Output is correct
17 Correct 1 ms 256 KB Output is correct
18 Correct 1 ms 416 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 1 ms 384 KB Output is correct
2 Correct 1 ms 256 KB Output is correct
3 Correct 1 ms 384 KB Output is correct
4 Correct 1 ms 256 KB Output is correct
5 Correct 1 ms 256 KB Output is correct
6 Correct 1 ms 384 KB Output is correct
7 Correct 1 ms 256 KB Output is correct
8 Correct 1 ms 384 KB Output is correct
9 Correct 1 ms 256 KB Output is correct
10 Correct 1 ms 384 KB Output is correct
11 Correct 1 ms 384 KB Output is correct
12 Correct 1 ms 384 KB Output is correct
13 Correct 1 ms 384 KB Output is correct
14 Correct 1 ms 384 KB Output is correct
15 Correct 1 ms 384 KB Output is correct
16 Correct 1 ms 384 KB Output is correct
17 Correct 1 ms 256 KB Output is correct
18 Correct 1 ms 416 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 2 ms 512 KB Output is correct
29 Correct 1 ms 384 KB Output is correct
30 Correct 1 ms 384 KB Output is correct
31 Correct 2 ms 384 KB Output is correct
32 Correct 1 ms 384 KB Output is correct
33 Correct 2 ms 512 KB Output is correct
34 Correct 2 ms 512 KB Output is correct
35 Correct 2 ms 512 KB Output is correct
36 Correct 2 ms 512 KB Output is correct
37 Correct 2 ms 512 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 384 KB Output is correct
2 Correct 1 ms 256 KB Output is correct
3 Correct 1 ms 384 KB Output is correct
4 Correct 1 ms 256 KB Output is correct
5 Correct 1 ms 256 KB Output is correct
6 Correct 1 ms 384 KB Output is correct
7 Correct 1 ms 256 KB Output is correct
8 Correct 1 ms 384 KB Output is correct
9 Correct 1 ms 256 KB Output is correct
10 Correct 1 ms 384 KB Output is correct
11 Correct 1 ms 384 KB Output is correct
12 Correct 1 ms 384 KB Output is correct
13 Correct 1 ms 384 KB Output is correct
14 Correct 1 ms 384 KB Output is correct
15 Correct 1 ms 384 KB Output is correct
16 Correct 1 ms 384 KB Output is correct
17 Correct 1 ms 256 KB Output is correct
18 Correct 1 ms 416 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 2 ms 512 KB Output is correct
29 Correct 1 ms 384 KB Output is correct
30 Correct 1 ms 384 KB Output is correct
31 Correct 2 ms 384 KB Output is correct
32 Correct 1 ms 384 KB Output is correct
33 Correct 2 ms 512 KB Output is correct
34 Correct 2 ms 512 KB Output is correct
35 Correct 2 ms 512 KB Output is correct
36 Correct 2 ms 512 KB Output is correct
37 Correct 2 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 5 ms 640 KB Output is correct
42 Correct 6 ms 640 KB Output is correct
43 Correct 7 ms 1024 KB Output is correct
44 Correct 10 ms 1024 KB Output is correct
45 Correct 7 ms 1056 KB Output is correct
46 Correct 6 ms 1024 KB Output is correct
47 Correct 8 ms 1024 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 4 ms 768 KB on inputs (0, 0), (0, 129), expected 0, but computed 1
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 384 KB Output is correct
2 Correct 1 ms 384 KB Output is correct
3 Correct 4 ms 640 KB Output is correct
4 Correct 4 ms 672 KB Output is correct
5 Correct 5 ms 640 KB Output is correct
6 Correct 4 ms 640 KB Output is correct
7 Correct 3 ms 744 KB Output is correct
8 Correct 5 ms 768 KB Output is correct
9 Correct 5 ms 768 KB Output is correct
10 Correct 5 ms 768 KB Output is correct
11 Correct 6 ms 768 KB Output is correct
12 Correct 5 ms 768 KB Output is correct
13 Correct 4 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 760 KB Output is correct
17 Correct 4 ms 768 KB Output is correct
18 Correct 5 ms 768 KB Output is correct
19 Correct 5 ms 768 KB Output is correct
20 Correct 10 ms 1276 KB Output is correct
21 Correct 12 ms 1276 KB Output is correct
22 Correct 12 ms 1308 KB Output is correct
23 Correct 11 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 18 ms 1888 KB Output is correct
28 Correct 17 ms 1912 KB Output is correct
29 Correct 17 ms 1912 KB Output is correct
30 Correct 17 ms 1912 KB Output is correct
31 Correct 21 ms 1912 KB Output is correct
32 Correct 1 ms 256 KB Output is correct
33 Correct 1 ms 256 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 16 ms 1912 KB Output is correct
2 Correct 1 ms 384 KB Output is correct
3 Correct 4 ms 640 KB Output is correct
4 Correct 5 ms 768 KB Output is correct
5 Incorrect 4 ms 768 KB on inputs (0, 0), (0, 129), expected 0, but computed 1
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 384 KB Output is correct
2 Correct 1 ms 256 KB Output is correct
3 Correct 1 ms 384 KB Output is correct
4 Correct 1 ms 256 KB Output is correct
5 Correct 1 ms 256 KB Output is correct
6 Correct 1 ms 384 KB Output is correct
7 Correct 1 ms 256 KB Output is correct
8 Correct 1 ms 384 KB Output is correct
9 Correct 1 ms 256 KB Output is correct
10 Correct 1 ms 384 KB Output is correct
11 Correct 1 ms 384 KB Output is correct
12 Correct 1 ms 384 KB Output is correct
13 Correct 1 ms 384 KB Output is correct
14 Correct 1 ms 384 KB Output is correct
15 Correct 1 ms 384 KB Output is correct
16 Correct 1 ms 384 KB Output is correct
17 Correct 1 ms 256 KB Output is correct
18 Correct 1 ms 416 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 2 ms 512 KB Output is correct
29 Correct 1 ms 384 KB Output is correct
30 Correct 1 ms 384 KB Output is correct
31 Correct 2 ms 384 KB Output is correct
32 Correct 1 ms 384 KB Output is correct
33 Correct 2 ms 512 KB Output is correct
34 Correct 2 ms 512 KB Output is correct
35 Correct 2 ms 512 KB Output is correct
36 Correct 2 ms 512 KB Output is correct
37 Correct 2 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 5 ms 640 KB Output is correct
42 Correct 6 ms 640 KB Output is correct
43 Correct 7 ms 1024 KB Output is correct
44 Correct 10 ms 1024 KB Output is correct
45 Correct 7 ms 1056 KB Output is correct
46 Correct 6 ms 1024 KB Output is correct
47 Correct 8 ms 1024 KB Output is correct
48 Incorrect 4 ms 768 KB on inputs (0, 0), (0, 129), expected 0, but computed 1
49 Halted 0 ms 0 KB -