답안 #813259

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
813259 2023-08-07T14:41:39 Z physics07 Vision Program (IOI19_vision) C++17
100 / 100
15 ms 2244 KB
#include "vision.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int dis(int x, int y, int a, int b) {
    return abs(x-a)+abs(y-b);
}
int w;
int num(int x, int y) {
    return x*w+y;
}
int locknum[2], row, col;
pair<int, int> calc(pair<int, int> prv, int curr) {
    vector<int> v;
    v={curr, prv.first};
    pair<int, int> on={add_and(v), 0};
    on.second=on.first;
    for(int i=prv.first+1; i<=min(prv.second, prv.first+8); i++) {
        v={on.second, i};
        on.second=add_and(v);
    }
    v={prv.first, curr};
    pair<int, int> res={add_xor(v), 0};
    res.second=res.first;
    for(int i=prv.first+1, j=on.first; j<=on.second; i++, j++) {
        if(i>prv.second) v={locknum[0], j};
        else v={i, j};
        res.second=add_xor(v);
    }
    return res;
}
void construct_network(int n, int m, int k) {
	vector<int> v;
	w=m;
	for(int i=0; i<n; i++) for(int j=0; j<m; j++) v.push_back(num(i, j));
	locknum[1]=add_or(v);
	locknum[0]=add_not(locknum[1]);
	v.clear();
	int s=locknum[0]+1, e=locknum[0]+1;
	for(int i=0; i<n; i++) {
        for(int j=0; j<m; j++) v.push_back(num(i, j));
        e=add_or(v);
        v.clear();
	}
	for(int i=s; i<=e; i++) v.push_back(i);
	int state=add_xor(v);
	state=add_not(state);
	v={locknum[0], s};
	row=add_xor(v);
	v.clear();
	for(int i=s+1; i<=e; i++) {
        v={row+i-s-1, i};
        add_xor(v);
	}
	for(int i=0; i<n; i++) {
        v={row+i, state};
        add_and(v);
	}
	v.clear();
	row+=n;
	s=row+n;
	for(int i=0; i<m; i++) {
        for(int j=0; j<n; j++) v.push_back(num(j, i));
        e=add_or(v);
        v.clear();
	}
	for(int i=s; i<=e; i++) v.push_back(i);
	state=add_xor(v);
	state=add_not(state);
	v={locknum[0], s};
	col=add_xor(v);
	for(int i=s+1; i<=e; i++) {
        v={col+i-s-1, i};
        add_xor(v);
	}
	for(int i=0; i<m; i++) {
        v={col+i, state};
        add_and(v);
	}
	col+=m;
	v.clear();
	for(int i=0; i<n; i++) v.push_back(row+i);
	for(int i=0; i<m; i++) v.push_back(col+i);
	pair<int, int> res={locknum[0], locknum[0]};
	for(auto i: v) res=calc(res, i);
	v={locknum[0]};
    while(res.second<res.first+9) res.second=add_and(v);
    pair<int, int> digit={res.second+1, res.second+1};
    for(int i=0; i<10; i++) {
        v={locknum[!!(k&1<<i)], res.first+i};
        digit.second=add_xor(v);
    }
    v.clear();
    for(int i=digit.first; i<=digit.second; i++) v.push_back(i);
    int ans=add_or(v);
    add_not(ans);
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 292 KB Output is correct
5 Correct 1 ms 300 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 296 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 0 ms 300 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 0 ms 212 KB Output is correct
14 Correct 0 ms 212 KB Output is correct
15 Correct 1 ms 212 KB Output is correct
16 Correct 1 ms 212 KB Output is correct
17 Correct 0 ms 212 KB Output is correct
18 Correct 0 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 292 KB Output is correct
5 Correct 1 ms 300 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 296 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 0 ms 300 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 0 ms 212 KB Output is correct
14 Correct 0 ms 212 KB Output is correct
15 Correct 1 ms 212 KB Output is correct
16 Correct 1 ms 212 KB Output is correct
17 Correct 0 ms 212 KB Output is correct
18 Correct 0 ms 212 KB Output is correct
19 Correct 1 ms 212 KB Output is correct
20 Correct 1 ms 212 KB Output is correct
21 Correct 1 ms 296 KB Output is correct
22 Correct 1 ms 212 KB Output is correct
23 Correct 1 ms 340 KB Output is correct
24 Correct 1 ms 340 KB Output is correct
25 Correct 1 ms 340 KB Output is correct
26 Correct 1 ms 340 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 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 292 KB Output is correct
5 Correct 1 ms 300 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 296 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 0 ms 300 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 0 ms 212 KB Output is correct
14 Correct 0 ms 212 KB Output is correct
15 Correct 1 ms 212 KB Output is correct
16 Correct 1 ms 212 KB Output is correct
17 Correct 0 ms 212 KB Output is correct
18 Correct 0 ms 212 KB Output is correct
19 Correct 1 ms 212 KB Output is correct
20 Correct 1 ms 212 KB Output is correct
21 Correct 1 ms 296 KB Output is correct
22 Correct 1 ms 212 KB Output is correct
23 Correct 1 ms 340 KB Output is correct
24 Correct 1 ms 340 KB Output is correct
25 Correct 1 ms 340 KB Output is correct
26 Correct 1 ms 340 KB Output is correct
27 Correct 1 ms 212 KB Output is correct
28 Correct 1 ms 428 KB Output is correct
29 Correct 1 ms 340 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 1 ms 340 KB Output is correct
34 Correct 2 ms 340 KB Output is correct
35 Correct 2 ms 424 KB Output is correct
36 Correct 2 ms 340 KB Output is correct
37 Correct 2 ms 428 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 292 KB Output is correct
5 Correct 1 ms 300 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 296 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 0 ms 300 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 0 ms 212 KB Output is correct
14 Correct 0 ms 212 KB Output is correct
15 Correct 1 ms 212 KB Output is correct
16 Correct 1 ms 212 KB Output is correct
17 Correct 0 ms 212 KB Output is correct
18 Correct 0 ms 212 KB Output is correct
19 Correct 1 ms 212 KB Output is correct
20 Correct 1 ms 212 KB Output is correct
21 Correct 1 ms 296 KB Output is correct
22 Correct 1 ms 212 KB Output is correct
23 Correct 1 ms 340 KB Output is correct
24 Correct 1 ms 340 KB Output is correct
25 Correct 1 ms 340 KB Output is correct
26 Correct 1 ms 340 KB Output is correct
27 Correct 1 ms 212 KB Output is correct
28 Correct 1 ms 428 KB Output is correct
29 Correct 1 ms 340 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 1 ms 340 KB Output is correct
34 Correct 2 ms 340 KB Output is correct
35 Correct 2 ms 424 KB Output is correct
36 Correct 2 ms 340 KB Output is correct
37 Correct 2 ms 428 KB Output is correct
38 Correct 5 ms 852 KB Output is correct
39 Correct 2 ms 428 KB Output is correct
40 Correct 2 ms 468 KB Output is correct
41 Correct 4 ms 724 KB Output is correct
42 Correct 3 ms 684 KB Output is correct
43 Correct 4 ms 936 KB Output is correct
44 Correct 5 ms 932 KB Output is correct
45 Correct 4 ms 848 KB Output is correct
46 Correct 4 ms 852 KB Output is correct
47 Correct 5 ms 852 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 596 KB Output is correct
2 Correct 2 ms 684 KB Output is correct
3 Correct 3 ms 684 KB Output is correct
4 Correct 2 ms 680 KB Output is correct
5 Correct 2 ms 596 KB Output is correct
6 Correct 2 ms 596 KB Output is correct
7 Correct 3 ms 596 KB Output is correct
8 Correct 2 ms 596 KB Output is correct
9 Correct 2 ms 684 KB Output is correct
10 Correct 2 ms 680 KB Output is correct
11 Correct 2 ms 596 KB Output is correct
12 Correct 2 ms 596 KB Output is correct
13 Correct 2 ms 596 KB Output is correct
14 Correct 2 ms 596 KB Output is correct
15 Correct 2 ms 596 KB Output is correct
16 Correct 2 ms 596 KB Output is correct
17 Correct 2 ms 596 KB Output is correct
18 Correct 2 ms 676 KB Output is correct
19 Correct 3 ms 596 KB Output is correct
20 Correct 2 ms 596 KB Output is correct
21 Correct 0 ms 212 KB Output is correct
22 Correct 0 ms 304 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 300 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 2 ms 596 KB Output is correct
4 Correct 2 ms 596 KB Output is correct
5 Correct 2 ms 596 KB Output is correct
6 Correct 2 ms 572 KB Output is correct
7 Correct 2 ms 596 KB Output is correct
8 Correct 3 ms 680 KB Output is correct
9 Correct 3 ms 724 KB Output is correct
10 Correct 3 ms 724 KB Output is correct
11 Correct 5 ms 724 KB Output is correct
12 Correct 3 ms 724 KB Output is correct
13 Correct 2 ms 596 KB Output is correct
14 Correct 2 ms 596 KB Output is correct
15 Correct 3 ms 596 KB Output is correct
16 Correct 2 ms 684 KB Output is correct
17 Correct 2 ms 596 KB Output is correct
18 Correct 2 ms 596 KB Output is correct
19 Correct 2 ms 684 KB Output is correct
20 Correct 7 ms 1280 KB Output is correct
21 Correct 8 ms 1408 KB Output is correct
22 Correct 8 ms 1280 KB Output is correct
23 Correct 8 ms 1316 KB Output is correct
24 Correct 11 ms 1368 KB Output is correct
25 Correct 8 ms 1280 KB Output is correct
26 Correct 7 ms 1340 KB Output is correct
27 Correct 13 ms 2104 KB Output is correct
28 Correct 13 ms 2060 KB Output is correct
29 Correct 13 ms 2108 KB Output is correct
30 Correct 13 ms 2056 KB Output is correct
31 Correct 13 ms 2104 KB Output is correct
32 Correct 0 ms 300 KB Output is correct
33 Correct 1 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 15 ms 2060 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 2 ms 596 KB Output is correct
4 Correct 3 ms 724 KB Output is correct
5 Correct 3 ms 724 KB Output is correct
6 Correct 2 ms 596 KB Output is correct
7 Correct 8 ms 1292 KB Output is correct
8 Correct 8 ms 1280 KB Output is correct
9 Correct 13 ms 2060 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 0 ms 300 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 292 KB Output is correct
5 Correct 1 ms 300 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 296 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 0 ms 300 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 0 ms 212 KB Output is correct
14 Correct 0 ms 212 KB Output is correct
15 Correct 1 ms 212 KB Output is correct
16 Correct 1 ms 212 KB Output is correct
17 Correct 0 ms 212 KB Output is correct
18 Correct 0 ms 212 KB Output is correct
19 Correct 1 ms 212 KB Output is correct
20 Correct 1 ms 212 KB Output is correct
21 Correct 1 ms 296 KB Output is correct
22 Correct 1 ms 212 KB Output is correct
23 Correct 1 ms 340 KB Output is correct
24 Correct 1 ms 340 KB Output is correct
25 Correct 1 ms 340 KB Output is correct
26 Correct 1 ms 340 KB Output is correct
27 Correct 1 ms 212 KB Output is correct
28 Correct 1 ms 428 KB Output is correct
29 Correct 1 ms 340 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 1 ms 340 KB Output is correct
34 Correct 2 ms 340 KB Output is correct
35 Correct 2 ms 424 KB Output is correct
36 Correct 2 ms 340 KB Output is correct
37 Correct 2 ms 428 KB Output is correct
38 Correct 5 ms 852 KB Output is correct
39 Correct 2 ms 428 KB Output is correct
40 Correct 2 ms 468 KB Output is correct
41 Correct 4 ms 724 KB Output is correct
42 Correct 3 ms 684 KB Output is correct
43 Correct 4 ms 936 KB Output is correct
44 Correct 5 ms 932 KB Output is correct
45 Correct 4 ms 848 KB Output is correct
46 Correct 4 ms 852 KB Output is correct
47 Correct 5 ms 852 KB Output is correct
48 Correct 2 ms 596 KB Output is correct
49 Correct 2 ms 684 KB Output is correct
50 Correct 3 ms 684 KB Output is correct
51 Correct 2 ms 680 KB Output is correct
52 Correct 2 ms 596 KB Output is correct
53 Correct 2 ms 596 KB Output is correct
54 Correct 3 ms 596 KB Output is correct
55 Correct 2 ms 596 KB Output is correct
56 Correct 2 ms 684 KB Output is correct
57 Correct 2 ms 680 KB Output is correct
58 Correct 2 ms 596 KB Output is correct
59 Correct 2 ms 596 KB Output is correct
60 Correct 2 ms 596 KB Output is correct
61 Correct 2 ms 596 KB Output is correct
62 Correct 2 ms 596 KB Output is correct
63 Correct 2 ms 596 KB Output is correct
64 Correct 2 ms 596 KB Output is correct
65 Correct 2 ms 676 KB Output is correct
66 Correct 3 ms 596 KB Output is correct
67 Correct 2 ms 596 KB Output is correct
68 Correct 0 ms 212 KB Output is correct
69 Correct 0 ms 304 KB Output is correct
70 Correct 0 ms 300 KB Output is correct
71 Correct 0 ms 212 KB Output is correct
72 Correct 2 ms 596 KB Output is correct
73 Correct 2 ms 596 KB Output is correct
74 Correct 2 ms 596 KB Output is correct
75 Correct 2 ms 572 KB Output is correct
76 Correct 2 ms 596 KB Output is correct
77 Correct 3 ms 680 KB Output is correct
78 Correct 3 ms 724 KB Output is correct
79 Correct 3 ms 724 KB Output is correct
80 Correct 5 ms 724 KB Output is correct
81 Correct 3 ms 724 KB Output is correct
82 Correct 2 ms 596 KB Output is correct
83 Correct 2 ms 596 KB Output is correct
84 Correct 3 ms 596 KB Output is correct
85 Correct 2 ms 684 KB Output is correct
86 Correct 2 ms 596 KB Output is correct
87 Correct 2 ms 596 KB Output is correct
88 Correct 2 ms 684 KB Output is correct
89 Correct 7 ms 1280 KB Output is correct
90 Correct 8 ms 1408 KB Output is correct
91 Correct 8 ms 1280 KB Output is correct
92 Correct 8 ms 1316 KB Output is correct
93 Correct 11 ms 1368 KB Output is correct
94 Correct 8 ms 1280 KB Output is correct
95 Correct 7 ms 1340 KB Output is correct
96 Correct 13 ms 2104 KB Output is correct
97 Correct 13 ms 2060 KB Output is correct
98 Correct 13 ms 2108 KB Output is correct
99 Correct 13 ms 2056 KB Output is correct
100 Correct 13 ms 2104 KB Output is correct
101 Correct 0 ms 300 KB Output is correct
102 Correct 1 ms 212 KB Output is correct
103 Correct 15 ms 2060 KB Output is correct
104 Correct 0 ms 212 KB Output is correct
105 Correct 2 ms 596 KB Output is correct
106 Correct 3 ms 724 KB Output is correct
107 Correct 3 ms 724 KB Output is correct
108 Correct 2 ms 596 KB Output is correct
109 Correct 8 ms 1292 KB Output is correct
110 Correct 8 ms 1280 KB Output is correct
111 Correct 13 ms 2060 KB Output is correct
112 Correct 1 ms 212 KB Output is correct
113 Correct 0 ms 300 KB Output is correct
114 Correct 13 ms 2052 KB Output is correct
115 Correct 2 ms 596 KB Output is correct
116 Correct 2 ms 596 KB Output is correct
117 Correct 7 ms 1280 KB Output is correct
118 Correct 8 ms 1368 KB Output is correct
119 Correct 13 ms 2072 KB Output is correct
120 Correct 13 ms 2068 KB Output is correct
121 Correct 13 ms 2164 KB Output is correct
122 Correct 13 ms 2068 KB Output is correct
123 Correct 15 ms 2060 KB Output is correct
124 Correct 14 ms 2144 KB Output is correct
125 Correct 13 ms 2168 KB Output is correct
126 Correct 13 ms 2148 KB Output is correct
127 Correct 13 ms 2244 KB Output is correct
128 Correct 13 ms 2116 KB Output is correct