답안 #385576

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
385576 2021-04-04T15:27:57 Z Sprdalo Vision Program (IOI19_vision) C++17
100 / 100
106 ms 7528 KB
#include"vision.h"
#include<bits/stdc++.h>
using namespace std;
int solve(int h, int w, int k){
	vector<int>diagL[400], diagR[400], prefL, prefR, ans;
	for(int i=0; i<h; i++)
		for(int j=0; j<w; j++){
			diagL[i+j].push_back(i*w+j);
			diagR[i+(w-1-j)].push_back(i*w+j);
		}
	for(int d=k; d<h+w-1; d++){
		prefL.push_back(add_or(diagL[d-k]));
		prefR.push_back(add_or(diagR[d-k]));
		ans.push_back(add_and({add_or(diagL[d]), add_or(prefL)}));
		ans.push_back(add_and({add_or(diagR[d]), add_or(prefR)}));
	}
	return add_or(ans);
}
void construct_network(int h, int w, int k){
	if(k==h+w-2) solve(h, w, k);
	else add_and({solve(h, w, k), add_not(solve(h, w, k+1))});
}

/*
signed main()
{
    ios_base::sync_with_stdio(false); 
    cin.tie(nullptr); 
    cout.tie(nullptr); 
    cerr.tie(nullptr);    
    
    int h, w, k;
    cin >> h >> w >> k;

    int q; cin >> q;

    int x1=0, y1=0, x2=0, y2=0;
    for (int e = 0; e < q; ++e){
        A = vi(h*w,0);
        cin >> x1 >> y1 >> x2 >> y2;
        A[x1*w+y1] = A[x2*w+y2] = 1;

        last = -1;
        construct_network(h,w,k);

        cout << last << '\n';
    }
}signed main()
{
    ios_base::sync_with_stdio(false); 
    cin.tie(nullptr); 
    cout.tie(nullptr); 
    cerr.tie(nullptr);    
    
    int h, w, k;
    cin >> h >> w >> k;

    int q; cin >> q;

    int x1=0, y1=0, x2=0, y2=0;
    for (int e = 0; e < q; ++e){
        A = vi(h*w,0);
        cin >> x1 >> y1 >> x2 >> y2;
        A[x1*w+y1] = A[x2*w+y2] = 1;

        last = -1;
        construct_network(h,w,k);

        cout << last << '\n';
    }
}signed main()
{
    ios_base::sync_with_stdio(false); 
    cin.tie(nullptr); 
    cout.tie(nullptr); 
    cerr.tie(nullptr);    
    
    int h, w, k;
    cin >> h >> w >> k;

    int q; cin >> q;

    int x1=0, y1=0, x2=0, y2=0;
    for (int e = 0; e < q; ++e){
        A = vi(h*w,0);
        cin >> x1 >> y1 >> x2 >> y2;
        A[x1*w+y1] = A[x2*w+y2] = 1;

        last = -1;
        construct_network(h,w,k);

        cout << last << '\n';
    }
}signed main()
{
    ios_base::sync_with_stdio(false); 
    cin.tie(nullptr); 
    cout.tie(nullptr); 
    cerr.tie(nullptr);    
    
    int h, w, k;
    cin >> h >> w >> k;

    int q; cin >> q;

    int x1=0, y1=0, x2=0, y2=0;
    for (int e = 0; e < q; ++e){
        A = vi(h*w,0);
        cin >> x1 >> y1 >> x2 >> y2;
        A[x1*w+y1] = A[x2*w+y2] = 1;

        last = -1;
        construct_network(h,w,k);

        cout << last << '\n';
    }
}
*/
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 364 KB Output is correct
2 Correct 2 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Correct 2 ms 364 KB Output is correct
6 Correct 1 ms 364 KB Output is correct
7 Correct 1 ms 364 KB Output is correct
8 Correct 1 ms 364 KB Output is correct
9 Correct 1 ms 364 KB Output is correct
10 Correct 1 ms 364 KB Output is correct
11 Correct 1 ms 364 KB Output is correct
12 Correct 1 ms 364 KB Output is correct
13 Correct 1 ms 384 KB Output is correct
14 Correct 2 ms 364 KB Output is correct
15 Correct 1 ms 364 KB Output is correct
16 Correct 2 ms 380 KB Output is correct
17 Correct 1 ms 364 KB Output is correct
18 Correct 1 ms 364 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 364 KB Output is correct
2 Correct 2 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Correct 2 ms 364 KB Output is correct
6 Correct 1 ms 364 KB Output is correct
7 Correct 1 ms 364 KB Output is correct
8 Correct 1 ms 364 KB Output is correct
9 Correct 1 ms 364 KB Output is correct
10 Correct 1 ms 364 KB Output is correct
11 Correct 1 ms 364 KB Output is correct
12 Correct 1 ms 364 KB Output is correct
13 Correct 1 ms 384 KB Output is correct
14 Correct 2 ms 364 KB Output is correct
15 Correct 1 ms 364 KB Output is correct
16 Correct 2 ms 380 KB Output is correct
17 Correct 1 ms 364 KB Output is correct
18 Correct 1 ms 364 KB Output is correct
19 Correct 1 ms 364 KB Output is correct
20 Correct 1 ms 364 KB Output is correct
21 Correct 2 ms 364 KB Output is correct
22 Correct 1 ms 364 KB Output is correct
23 Correct 2 ms 364 KB Output is correct
24 Correct 1 ms 364 KB Output is correct
25 Correct 1 ms 364 KB Output is correct
26 Correct 2 ms 364 KB Output is correct
27 Correct 2 ms 364 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 364 KB Output is correct
2 Correct 2 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Correct 2 ms 364 KB Output is correct
6 Correct 1 ms 364 KB Output is correct
7 Correct 1 ms 364 KB Output is correct
8 Correct 1 ms 364 KB Output is correct
9 Correct 1 ms 364 KB Output is correct
10 Correct 1 ms 364 KB Output is correct
11 Correct 1 ms 364 KB Output is correct
12 Correct 1 ms 364 KB Output is correct
13 Correct 1 ms 384 KB Output is correct
14 Correct 2 ms 364 KB Output is correct
15 Correct 1 ms 364 KB Output is correct
16 Correct 2 ms 380 KB Output is correct
17 Correct 1 ms 364 KB Output is correct
18 Correct 1 ms 364 KB Output is correct
19 Correct 1 ms 364 KB Output is correct
20 Correct 1 ms 364 KB Output is correct
21 Correct 2 ms 364 KB Output is correct
22 Correct 1 ms 364 KB Output is correct
23 Correct 2 ms 364 KB Output is correct
24 Correct 1 ms 364 KB Output is correct
25 Correct 1 ms 364 KB Output is correct
26 Correct 2 ms 364 KB Output is correct
27 Correct 2 ms 364 KB Output is correct
28 Correct 3 ms 492 KB Output is correct
29 Correct 2 ms 376 KB Output is correct
30 Correct 2 ms 492 KB Output is correct
31 Correct 2 ms 364 KB Output is correct
32 Correct 2 ms 492 KB Output is correct
33 Correct 3 ms 492 KB Output is correct
34 Correct 3 ms 492 KB Output is correct
35 Correct 2 ms 384 KB Output is correct
36 Correct 1 ms 364 KB Output is correct
37 Correct 1 ms 364 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 364 KB Output is correct
2 Correct 2 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Correct 2 ms 364 KB Output is correct
6 Correct 1 ms 364 KB Output is correct
7 Correct 1 ms 364 KB Output is correct
8 Correct 1 ms 364 KB Output is correct
9 Correct 1 ms 364 KB Output is correct
10 Correct 1 ms 364 KB Output is correct
11 Correct 1 ms 364 KB Output is correct
12 Correct 1 ms 364 KB Output is correct
13 Correct 1 ms 384 KB Output is correct
14 Correct 2 ms 364 KB Output is correct
15 Correct 1 ms 364 KB Output is correct
16 Correct 2 ms 380 KB Output is correct
17 Correct 1 ms 364 KB Output is correct
18 Correct 1 ms 364 KB Output is correct
19 Correct 1 ms 364 KB Output is correct
20 Correct 1 ms 364 KB Output is correct
21 Correct 2 ms 364 KB Output is correct
22 Correct 1 ms 364 KB Output is correct
23 Correct 2 ms 364 KB Output is correct
24 Correct 1 ms 364 KB Output is correct
25 Correct 1 ms 364 KB Output is correct
26 Correct 2 ms 364 KB Output is correct
27 Correct 2 ms 364 KB Output is correct
28 Correct 3 ms 492 KB Output is correct
29 Correct 2 ms 376 KB Output is correct
30 Correct 2 ms 492 KB Output is correct
31 Correct 2 ms 364 KB Output is correct
32 Correct 2 ms 492 KB Output is correct
33 Correct 3 ms 492 KB Output is correct
34 Correct 3 ms 492 KB Output is correct
35 Correct 2 ms 384 KB Output is correct
36 Correct 1 ms 364 KB Output is correct
37 Correct 1 ms 364 KB Output is correct
38 Correct 15 ms 1644 KB Output is correct
39 Correct 3 ms 492 KB Output is correct
40 Correct 2 ms 364 KB Output is correct
41 Correct 12 ms 1260 KB Output is correct
42 Correct 2 ms 364 KB Output is correct
43 Correct 21 ms 2160 KB Output is correct
44 Correct 20 ms 1656 KB Output is correct
45 Correct 13 ms 1132 KB Output is correct
46 Correct 5 ms 620 KB Output is correct
47 Correct 1 ms 492 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 21 ms 1320 KB Output is correct
2 Correct 6 ms 620 KB Output is correct
3 Correct 4 ms 620 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Correct 11 ms 1260 KB Output is correct
6 Correct 7 ms 876 KB Output is correct
7 Correct 6 ms 492 KB Output is correct
8 Correct 2 ms 364 KB Output is correct
9 Correct 12 ms 1260 KB Output is correct
10 Correct 10 ms 876 KB Output is correct
11 Correct 6 ms 640 KB Output is correct
12 Correct 4 ms 620 KB Output is correct
13 Correct 3 ms 500 KB Output is correct
14 Correct 1 ms 364 KB Output is correct
15 Correct 15 ms 1260 KB Output is correct
16 Correct 10 ms 876 KB Output is correct
17 Correct 4 ms 620 KB Output is correct
18 Correct 4 ms 620 KB Output is correct
19 Correct 2 ms 492 KB Output is correct
20 Correct 1 ms 364 KB Output is correct
21 Correct 1 ms 364 KB Output is correct
22 Correct 1 ms 364 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 11 ms 1004 KB Output is correct
4 Correct 6 ms 748 KB Output is correct
5 Correct 4 ms 620 KB Output is correct
6 Correct 3 ms 492 KB Output is correct
7 Correct 1 ms 372 KB Output is correct
8 Correct 23 ms 1644 KB Output is correct
9 Correct 11 ms 1260 KB Output is correct
10 Correct 6 ms 876 KB Output is correct
11 Correct 3 ms 620 KB Output is correct
12 Correct 2 ms 364 KB Output is correct
13 Correct 12 ms 1260 KB Output is correct
14 Correct 7 ms 876 KB Output is correct
15 Correct 2 ms 492 KB Output is correct
16 Correct 1 ms 364 KB Output is correct
17 Correct 11 ms 1260 KB Output is correct
18 Correct 4 ms 620 KB Output is correct
19 Correct 1 ms 364 KB Output is correct
20 Correct 55 ms 4200 KB Output is correct
21 Correct 26 ms 2668 KB Output is correct
22 Correct 9 ms 1260 KB Output is correct
23 Correct 2 ms 620 KB Output is correct
24 Correct 42 ms 4200 KB Output is correct
25 Correct 17 ms 1900 KB Output is correct
26 Correct 2 ms 620 KB Output is correct
27 Correct 76 ms 7528 KB Output is correct
28 Correct 69 ms 5736 KB Output is correct
29 Correct 31 ms 3308 KB Output is correct
30 Correct 14 ms 1516 KB Output is correct
31 Correct 2 ms 876 KB Output is correct
32 Correct 1 ms 364 KB Output is correct
33 Correct 1 ms 364 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 75 ms 7460 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 10 ms 1004 KB Output is correct
4 Correct 15 ms 1644 KB Output is correct
5 Correct 11 ms 1260 KB Output is correct
6 Correct 11 ms 1260 KB Output is correct
7 Correct 51 ms 4200 KB Output is correct
8 Correct 47 ms 4200 KB Output is correct
9 Correct 106 ms 7528 KB Output is correct
10 Correct 1 ms 364 KB Output is correct
11 Correct 3 ms 364 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 364 KB Output is correct
2 Correct 2 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Correct 2 ms 364 KB Output is correct
6 Correct 1 ms 364 KB Output is correct
7 Correct 1 ms 364 KB Output is correct
8 Correct 1 ms 364 KB Output is correct
9 Correct 1 ms 364 KB Output is correct
10 Correct 1 ms 364 KB Output is correct
11 Correct 1 ms 364 KB Output is correct
12 Correct 1 ms 364 KB Output is correct
13 Correct 1 ms 384 KB Output is correct
14 Correct 2 ms 364 KB Output is correct
15 Correct 1 ms 364 KB Output is correct
16 Correct 2 ms 380 KB Output is correct
17 Correct 1 ms 364 KB Output is correct
18 Correct 1 ms 364 KB Output is correct
19 Correct 1 ms 364 KB Output is correct
20 Correct 1 ms 364 KB Output is correct
21 Correct 2 ms 364 KB Output is correct
22 Correct 1 ms 364 KB Output is correct
23 Correct 2 ms 364 KB Output is correct
24 Correct 1 ms 364 KB Output is correct
25 Correct 1 ms 364 KB Output is correct
26 Correct 2 ms 364 KB Output is correct
27 Correct 2 ms 364 KB Output is correct
28 Correct 3 ms 492 KB Output is correct
29 Correct 2 ms 376 KB Output is correct
30 Correct 2 ms 492 KB Output is correct
31 Correct 2 ms 364 KB Output is correct
32 Correct 2 ms 492 KB Output is correct
33 Correct 3 ms 492 KB Output is correct
34 Correct 3 ms 492 KB Output is correct
35 Correct 2 ms 384 KB Output is correct
36 Correct 1 ms 364 KB Output is correct
37 Correct 1 ms 364 KB Output is correct
38 Correct 15 ms 1644 KB Output is correct
39 Correct 3 ms 492 KB Output is correct
40 Correct 2 ms 364 KB Output is correct
41 Correct 12 ms 1260 KB Output is correct
42 Correct 2 ms 364 KB Output is correct
43 Correct 21 ms 2160 KB Output is correct
44 Correct 20 ms 1656 KB Output is correct
45 Correct 13 ms 1132 KB Output is correct
46 Correct 5 ms 620 KB Output is correct
47 Correct 1 ms 492 KB Output is correct
48 Correct 21 ms 1320 KB Output is correct
49 Correct 6 ms 620 KB Output is correct
50 Correct 4 ms 620 KB Output is correct
51 Correct 1 ms 364 KB Output is correct
52 Correct 11 ms 1260 KB Output is correct
53 Correct 7 ms 876 KB Output is correct
54 Correct 6 ms 492 KB Output is correct
55 Correct 2 ms 364 KB Output is correct
56 Correct 12 ms 1260 KB Output is correct
57 Correct 10 ms 876 KB Output is correct
58 Correct 6 ms 640 KB Output is correct
59 Correct 4 ms 620 KB Output is correct
60 Correct 3 ms 500 KB Output is correct
61 Correct 1 ms 364 KB Output is correct
62 Correct 15 ms 1260 KB Output is correct
63 Correct 10 ms 876 KB Output is correct
64 Correct 4 ms 620 KB Output is correct
65 Correct 4 ms 620 KB Output is correct
66 Correct 2 ms 492 KB Output is correct
67 Correct 1 ms 364 KB Output is correct
68 Correct 1 ms 364 KB Output is correct
69 Correct 1 ms 364 KB Output is correct
70 Correct 1 ms 364 KB Output is correct
71 Correct 1 ms 364 KB Output is correct
72 Correct 11 ms 1004 KB Output is correct
73 Correct 6 ms 748 KB Output is correct
74 Correct 4 ms 620 KB Output is correct
75 Correct 3 ms 492 KB Output is correct
76 Correct 1 ms 372 KB Output is correct
77 Correct 23 ms 1644 KB Output is correct
78 Correct 11 ms 1260 KB Output is correct
79 Correct 6 ms 876 KB Output is correct
80 Correct 3 ms 620 KB Output is correct
81 Correct 2 ms 364 KB Output is correct
82 Correct 12 ms 1260 KB Output is correct
83 Correct 7 ms 876 KB Output is correct
84 Correct 2 ms 492 KB Output is correct
85 Correct 1 ms 364 KB Output is correct
86 Correct 11 ms 1260 KB Output is correct
87 Correct 4 ms 620 KB Output is correct
88 Correct 1 ms 364 KB Output is correct
89 Correct 55 ms 4200 KB Output is correct
90 Correct 26 ms 2668 KB Output is correct
91 Correct 9 ms 1260 KB Output is correct
92 Correct 2 ms 620 KB Output is correct
93 Correct 42 ms 4200 KB Output is correct
94 Correct 17 ms 1900 KB Output is correct
95 Correct 2 ms 620 KB Output is correct
96 Correct 76 ms 7528 KB Output is correct
97 Correct 69 ms 5736 KB Output is correct
98 Correct 31 ms 3308 KB Output is correct
99 Correct 14 ms 1516 KB Output is correct
100 Correct 2 ms 876 KB Output is correct
101 Correct 1 ms 364 KB Output is correct
102 Correct 1 ms 364 KB Output is correct
103 Correct 75 ms 7460 KB Output is correct
104 Correct 1 ms 364 KB Output is correct
105 Correct 10 ms 1004 KB Output is correct
106 Correct 15 ms 1644 KB Output is correct
107 Correct 11 ms 1260 KB Output is correct
108 Correct 11 ms 1260 KB Output is correct
109 Correct 51 ms 4200 KB Output is correct
110 Correct 47 ms 4200 KB Output is correct
111 Correct 106 ms 7528 KB Output is correct
112 Correct 1 ms 364 KB Output is correct
113 Correct 3 ms 364 KB Output is correct
114 Correct 69 ms 5736 KB Output is correct
115 Correct 2 ms 364 KB Output is correct
116 Correct 11 ms 1260 KB Output is correct
117 Correct 4 ms 748 KB Output is correct
118 Correct 34 ms 3488 KB Output is correct
119 Correct 37 ms 3508 KB Output is correct
120 Correct 30 ms 3308 KB Output is correct
121 Correct 37 ms 3308 KB Output is correct
122 Correct 30 ms 3308 KB Output is correct
123 Correct 78 ms 7512 KB Output is correct
124 Correct 55 ms 5608 KB Output is correct
125 Correct 44 ms 3436 KB Output is correct
126 Correct 44 ms 3308 KB Output is correct
127 Correct 12 ms 1516 KB Output is correct
128 Correct 3 ms 1024 KB Output is correct