Submission #884571

# Submission time Handle Problem Language Result Execution time Memory
884571 2023-12-07T17:01:58 Z JakobZorz Vision Program (IOI19_vision) C++14
100 / 100
42 ms 5436 KB
#include"vision.h"
#include<iostream>
#include<vector>
using namespace std;

int w,h;

int get_cell(int x,int y){
    return y*w+x;
}

// or, oxr
pair<int,int>construct_diagonal1(int x,int y){
    vector<int>ins;
    while(x<w&&y<h){
        ins.push_back(get_cell(x,y));
        x++;
        y++;
    }
    return{add_or(ins),add_xor(ins)};
}

pair<int,int>construct_diagonal2(int x,int y){
    vector<int>ins;
    while(x>=0&&y<h){
        ins.push_back(get_cell(x,y));
        x--;
        y++;
    }
    return{add_or(ins),add_xor(ins)};
}

vector<int>func1(vector<pair<int,int>>arr1,int k){
    vector<int>arr2;
    
    for(int i=0;i+k<=(int)arr1.size();i++){
        vector<int>vec_or;
        vector<int>vec_xor;
        for(int j=i;j<i+k;j++){
            vec_or.push_back(arr1[j].first);
            vec_xor.push_back(arr1[j].second);
        }
        
        int gor=add_or(vec_or);
        int gxor=add_xor(vec_xor);
        int gnxor=add_not(gxor);
        arr2.push_back(add_and({gor,gnxor}));
    }
    
    return arr2;
}

void construct_network(int H,int W,int k){
    w=W;
    h=H;
    vector<pair<int,int>>diagonals1;
    for(int y=h-1;y>0;y--)
        diagonals1.push_back(construct_diagonal1(0,y));
    for(int x=0;x<w;x++)
        diagonals1.push_back(construct_diagonal1(x,0));
    
    vector<pair<int,int>>diagonals2;
    for(int x=0;x<w;x++)
        diagonals2.push_back(construct_diagonal2(x,0));
    for(int y=1;y<h;y++)
        diagonals2.push_back(construct_diagonal2(w-1,y));
    
    vector<int>intervals1,intervals2;
    vector<int>res;
    
    int or1=add_or(func1(diagonals1,k));
    int or2=add_or(func1(diagonals2,k));
    int or3=add_or(func1(diagonals1,k+1));
    int or4=add_or(func1(diagonals2,k+1));
    int and1=add_and({or1,or2});
    int and2=add_and({or3,or4});
    int not1=add_not(and1);
    add_and({and2,not1});
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 436 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 436 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 344 KB Output is correct
16 Correct 1 ms 348 KB Output is correct
17 Correct 0 ms 344 KB Output is correct
18 Correct 1 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 436 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 436 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 344 KB Output is correct
16 Correct 1 ms 348 KB Output is correct
17 Correct 0 ms 344 KB Output is correct
18 Correct 1 ms 348 KB Output is correct
19 Correct 0 ms 344 KB Output is correct
20 Correct 0 ms 348 KB Output is correct
21 Correct 0 ms 348 KB Output is correct
22 Correct 0 ms 348 KB Output is correct
23 Correct 1 ms 348 KB Output is correct
24 Correct 1 ms 348 KB Output is correct
25 Correct 0 ms 348 KB Output is correct
26 Correct 0 ms 348 KB Output is correct
27 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 436 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 436 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 344 KB Output is correct
16 Correct 1 ms 348 KB Output is correct
17 Correct 0 ms 344 KB Output is correct
18 Correct 1 ms 348 KB Output is correct
19 Correct 0 ms 344 KB Output is correct
20 Correct 0 ms 348 KB Output is correct
21 Correct 0 ms 348 KB Output is correct
22 Correct 0 ms 348 KB Output is correct
23 Correct 1 ms 348 KB Output is correct
24 Correct 1 ms 348 KB Output is correct
25 Correct 0 ms 348 KB Output is correct
26 Correct 0 ms 348 KB Output is correct
27 Correct 0 ms 348 KB Output is correct
28 Correct 2 ms 344 KB Output is correct
29 Correct 1 ms 348 KB Output is correct
30 Correct 1 ms 344 KB Output is correct
31 Correct 1 ms 344 KB Output is correct
32 Correct 1 ms 436 KB Output is correct
33 Correct 1 ms 348 KB Output is correct
34 Correct 2 ms 348 KB Output is correct
35 Correct 1 ms 348 KB Output is correct
36 Correct 1 ms 348 KB Output is correct
37 Correct 1 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 436 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 436 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 344 KB Output is correct
16 Correct 1 ms 348 KB Output is correct
17 Correct 0 ms 344 KB Output is correct
18 Correct 1 ms 348 KB Output is correct
19 Correct 0 ms 344 KB Output is correct
20 Correct 0 ms 348 KB Output is correct
21 Correct 0 ms 348 KB Output is correct
22 Correct 0 ms 348 KB Output is correct
23 Correct 1 ms 348 KB Output is correct
24 Correct 1 ms 348 KB Output is correct
25 Correct 0 ms 348 KB Output is correct
26 Correct 0 ms 348 KB Output is correct
27 Correct 0 ms 348 KB Output is correct
28 Correct 2 ms 344 KB Output is correct
29 Correct 1 ms 348 KB Output is correct
30 Correct 1 ms 344 KB Output is correct
31 Correct 1 ms 344 KB Output is correct
32 Correct 1 ms 436 KB Output is correct
33 Correct 1 ms 348 KB Output is correct
34 Correct 2 ms 348 KB Output is correct
35 Correct 1 ms 348 KB Output is correct
36 Correct 1 ms 348 KB Output is correct
37 Correct 1 ms 348 KB Output is correct
38 Correct 10 ms 1536 KB Output is correct
39 Correct 2 ms 604 KB Output is correct
40 Correct 2 ms 604 KB Output is correct
41 Correct 3 ms 692 KB Output is correct
42 Correct 2 ms 604 KB Output is correct
43 Correct 5 ms 1044 KB Output is correct
44 Correct 9 ms 1372 KB Output is correct
45 Correct 11 ms 1628 KB Output is correct
46 Correct 9 ms 1372 KB Output is correct
47 Correct 4 ms 860 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 604 KB Output is correct
2 Correct 7 ms 1116 KB Output is correct
3 Correct 10 ms 1112 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 2 ms 604 KB Output is correct
6 Correct 7 ms 1116 KB Output is correct
7 Correct 6 ms 1112 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 2 ms 604 KB Output is correct
10 Correct 6 ms 1116 KB Output is correct
11 Correct 8 ms 1112 KB Output is correct
12 Correct 7 ms 1116 KB Output is correct
13 Correct 6 ms 860 KB Output is correct
14 Correct 1 ms 348 KB Output is correct
15 Correct 2 ms 604 KB Output is correct
16 Correct 6 ms 1116 KB Output is correct
17 Correct 11 ms 1116 KB Output is correct
18 Correct 7 ms 1116 KB Output is correct
19 Correct 5 ms 780 KB Output is correct
20 Correct 1 ms 348 KB Output is correct
21 Correct 0 ms 348 KB Output is correct
22 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 608 KB Output is correct
3 Correct 2 ms 604 KB Output is correct
4 Correct 4 ms 860 KB Output is correct
5 Correct 4 ms 856 KB Output is correct
6 Correct 5 ms 860 KB Output is correct
7 Correct 2 ms 348 KB Output is correct
8 Correct 4 ms 860 KB Output is correct
9 Correct 10 ms 1116 KB Output is correct
10 Correct 10 ms 1372 KB Output is correct
11 Correct 6 ms 1116 KB Output is correct
12 Correct 3 ms 604 KB Output is correct
13 Correct 2 ms 732 KB Output is correct
14 Correct 7 ms 1112 KB Output is correct
15 Correct 6 ms 860 KB Output is correct
16 Correct 1 ms 344 KB Output is correct
17 Correct 2 ms 604 KB Output is correct
18 Correct 7 ms 1116 KB Output is correct
19 Correct 1 ms 348 KB Output is correct
20 Correct 9 ms 1496 KB Output is correct
21 Correct 21 ms 3028 KB Output is correct
22 Correct 20 ms 2896 KB Output is correct
23 Correct 9 ms 1116 KB Output is correct
24 Correct 9 ms 1496 KB Output is correct
25 Correct 22 ms 3048 KB Output is correct
26 Correct 7 ms 1116 KB Output is correct
27 Correct 16 ms 2520 KB Output is correct
28 Correct 34 ms 4556 KB Output is correct
29 Correct 40 ms 5324 KB Output is correct
30 Correct 34 ms 4436 KB Output is correct
31 Correct 14 ms 2136 KB Output is correct
32 Correct 0 ms 344 KB Output is correct
33 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 16 ms 2520 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 2 ms 604 KB Output is correct
4 Correct 3 ms 860 KB Output is correct
5 Correct 2 ms 604 KB Output is correct
6 Correct 2 ms 604 KB Output is correct
7 Correct 9 ms 1492 KB Output is correct
8 Correct 9 ms 1492 KB Output is correct
9 Correct 16 ms 2520 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 436 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 436 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 344 KB Output is correct
16 Correct 1 ms 348 KB Output is correct
17 Correct 0 ms 344 KB Output is correct
18 Correct 1 ms 348 KB Output is correct
19 Correct 0 ms 344 KB Output is correct
20 Correct 0 ms 348 KB Output is correct
21 Correct 0 ms 348 KB Output is correct
22 Correct 0 ms 348 KB Output is correct
23 Correct 1 ms 348 KB Output is correct
24 Correct 1 ms 348 KB Output is correct
25 Correct 0 ms 348 KB Output is correct
26 Correct 0 ms 348 KB Output is correct
27 Correct 0 ms 348 KB Output is correct
28 Correct 2 ms 344 KB Output is correct
29 Correct 1 ms 348 KB Output is correct
30 Correct 1 ms 344 KB Output is correct
31 Correct 1 ms 344 KB Output is correct
32 Correct 1 ms 436 KB Output is correct
33 Correct 1 ms 348 KB Output is correct
34 Correct 2 ms 348 KB Output is correct
35 Correct 1 ms 348 KB Output is correct
36 Correct 1 ms 348 KB Output is correct
37 Correct 1 ms 348 KB Output is correct
38 Correct 10 ms 1536 KB Output is correct
39 Correct 2 ms 604 KB Output is correct
40 Correct 2 ms 604 KB Output is correct
41 Correct 3 ms 692 KB Output is correct
42 Correct 2 ms 604 KB Output is correct
43 Correct 5 ms 1044 KB Output is correct
44 Correct 9 ms 1372 KB Output is correct
45 Correct 11 ms 1628 KB Output is correct
46 Correct 9 ms 1372 KB Output is correct
47 Correct 4 ms 860 KB Output is correct
48 Correct 2 ms 604 KB Output is correct
49 Correct 7 ms 1116 KB Output is correct
50 Correct 10 ms 1112 KB Output is correct
51 Correct 1 ms 348 KB Output is correct
52 Correct 2 ms 604 KB Output is correct
53 Correct 7 ms 1116 KB Output is correct
54 Correct 6 ms 1112 KB Output is correct
55 Correct 1 ms 348 KB Output is correct
56 Correct 2 ms 604 KB Output is correct
57 Correct 6 ms 1116 KB Output is correct
58 Correct 8 ms 1112 KB Output is correct
59 Correct 7 ms 1116 KB Output is correct
60 Correct 6 ms 860 KB Output is correct
61 Correct 1 ms 348 KB Output is correct
62 Correct 2 ms 604 KB Output is correct
63 Correct 6 ms 1116 KB Output is correct
64 Correct 11 ms 1116 KB Output is correct
65 Correct 7 ms 1116 KB Output is correct
66 Correct 5 ms 780 KB Output is correct
67 Correct 1 ms 348 KB Output is correct
68 Correct 0 ms 348 KB Output is correct
69 Correct 0 ms 348 KB Output is correct
70 Correct 0 ms 344 KB Output is correct
71 Correct 0 ms 608 KB Output is correct
72 Correct 2 ms 604 KB Output is correct
73 Correct 4 ms 860 KB Output is correct
74 Correct 4 ms 856 KB Output is correct
75 Correct 5 ms 860 KB Output is correct
76 Correct 2 ms 348 KB Output is correct
77 Correct 4 ms 860 KB Output is correct
78 Correct 10 ms 1116 KB Output is correct
79 Correct 10 ms 1372 KB Output is correct
80 Correct 6 ms 1116 KB Output is correct
81 Correct 3 ms 604 KB Output is correct
82 Correct 2 ms 732 KB Output is correct
83 Correct 7 ms 1112 KB Output is correct
84 Correct 6 ms 860 KB Output is correct
85 Correct 1 ms 344 KB Output is correct
86 Correct 2 ms 604 KB Output is correct
87 Correct 7 ms 1116 KB Output is correct
88 Correct 1 ms 348 KB Output is correct
89 Correct 9 ms 1496 KB Output is correct
90 Correct 21 ms 3028 KB Output is correct
91 Correct 20 ms 2896 KB Output is correct
92 Correct 9 ms 1116 KB Output is correct
93 Correct 9 ms 1496 KB Output is correct
94 Correct 22 ms 3048 KB Output is correct
95 Correct 7 ms 1116 KB Output is correct
96 Correct 16 ms 2520 KB Output is correct
97 Correct 34 ms 4556 KB Output is correct
98 Correct 40 ms 5324 KB Output is correct
99 Correct 34 ms 4436 KB Output is correct
100 Correct 14 ms 2136 KB Output is correct
101 Correct 0 ms 344 KB Output is correct
102 Correct 0 ms 348 KB Output is correct
103 Correct 16 ms 2520 KB Output is correct
104 Correct 0 ms 348 KB Output is correct
105 Correct 2 ms 604 KB Output is correct
106 Correct 3 ms 860 KB Output is correct
107 Correct 2 ms 604 KB Output is correct
108 Correct 2 ms 604 KB Output is correct
109 Correct 9 ms 1492 KB Output is correct
110 Correct 9 ms 1492 KB Output is correct
111 Correct 16 ms 2520 KB Output is correct
112 Correct 0 ms 348 KB Output is correct
113 Correct 0 ms 348 KB Output is correct
114 Correct 34 ms 4824 KB Output is correct
115 Correct 1 ms 348 KB Output is correct
116 Correct 2 ms 604 KB Output is correct
117 Correct 15 ms 2136 KB Output is correct
118 Correct 17 ms 2520 KB Output is correct
119 Correct 41 ms 5328 KB Output is correct
120 Correct 39 ms 5296 KB Output is correct
121 Correct 40 ms 5300 KB Output is correct
122 Correct 42 ms 5436 KB Output is correct
123 Correct 18 ms 2776 KB Output is correct
124 Correct 34 ms 4824 KB Output is correct
125 Correct 40 ms 5324 KB Output is correct
126 Correct 40 ms 5304 KB Output is correct
127 Correct 33 ms 4444 KB Output is correct
128 Correct 14 ms 2220 KB Output is correct