답안 #749268

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
749268 2023-05-27T15:40:54 Z grogu Vision Program (IOI19_vision) C++14
100 / 100
82 ms 7748 KB
#include "vision.h"
#define here cerr<<"===========================================\n"
#define dbg(x) cerr<<#x<<": "<<x<<endl;
#include <bits/stdc++.h>
#define ld double
#define ll int
#define ull unsigned long long
#define llinf 100000000000000000LL // 10^17
#define iinf 2000000000 // 2*10^9
#define pb push_back
#define popb pop_back
#define fi first
#define sc second
#define endl '\n'
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pld pair<ld,ld>
#define eb emplace_back
#define all(a) a.begin(),a.end()
#define ceri(a,l,r) {cerr<<#a<<": ";for(ll i_ = l;i_<=r;i_++) cerr<<a[i_]<< " ";cerr<<endl;}
#define cer(a) {cerr<<#a<<": ";for(ll x_ : a) cerr<<x_<< " ";cerr<<endl;}
#define si(a) (ll)(a.size())
using namespace std;
#define maxn 205
vector<ll> aks;
ll n,m,k;
ll kod(ll x,ll y){return (x-1)*m+y-1;}
ll zero,one;
ll reshi(vector<vector<ll> > v,ll k){
    vector<ll> vor,vxor;
    for(auto w : v){
        vor.pb(add_or(w));
        vxor.pb(add_xor(w));
    }
    vector<ll> vok;
    vok.pb(zero);
    for(ll i = 0;i+k-1<si(v);i++){
        vector<ll> cur;
        cur.pb(zero);
        for(ll j = i;j<=i+k-1;j++) cur.pb(vor[j]);
        ll x = add_or(cur);
        cur.clear();
        cur.pb(zero);
        for(ll j = i;j<=i+k-1;j++) cur.pb(vxor[j]);
        ll y = add_xor(cur);
        y = add_not(y);
        cur.clear();
        vok.pb(add_and({x,y}));
    }
    ll ans = add_or(vok);
    return ans;
}
ll reshi(ll k){
    vector<vector<ll> > diag;
    for(ll s = 2;s<=n+m;s++){
        vector<ll> v;
        for(ll i = 1;i<=n;i++){
            ll j = s-i;
            if(j>m||j<=0) continue;
            v.eb(kod(i,j));
        }
        v.pb(zero);
        diag.pb(v);
    }
    ll i = reshi(diag,k);
    diag.clear();
    for(ll s = 1-m;s<=n-1;s++){
        vector<ll> v;
        for(ll i = 1;i<=n;i++){
            ll j = i - s;
            if(j>m||j<=0) continue;
            v.eb(kod(i,j));
        }
        v.pb(zero);
        diag.pb(v);
    }
    ll j = reshi(diag,k);
    return add_and({i,j});
}
void construct_network(int H, int W, int K) {
    n = H;
    m = W;
    k = K;
    vector<ll> ask;
    for(ll i = 0;i<=n*m-1;i++) ask.pb(i);
    zero = add_xor(ask);
    one = add_not(zero);
    ll i = reshi(k+1);
    dbg(i);
    ll j = reshi(k);
    dbg(j);
    j = add_not(j);
    add_and({i,j});
}
/**
2 3 3
0 0 1 2
0 2 1 0

2 3 2
0 0 0 2
**/
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 308 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 308 KB Output is correct
4 Correct 1 ms 300 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 2 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 1 ms 308 KB Output is correct
12 Correct 1 ms 212 KB Output is correct
13 Correct 1 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 308 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Correct 1 ms 304 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 308 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 308 KB Output is correct
4 Correct 1 ms 300 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 2 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 1 ms 308 KB Output is correct
12 Correct 1 ms 212 KB Output is correct
13 Correct 1 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 308 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Correct 1 ms 304 KB Output is correct
19 Correct 1 ms 296 KB Output is correct
20 Correct 1 ms 280 KB Output is correct
21 Correct 1 ms 340 KB Output is correct
22 Correct 1 ms 304 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 300 KB Output is correct
27 Correct 1 ms 340 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 308 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 308 KB Output is correct
4 Correct 1 ms 300 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 2 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 1 ms 308 KB Output is correct
12 Correct 1 ms 212 KB Output is correct
13 Correct 1 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 308 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Correct 1 ms 304 KB Output is correct
19 Correct 1 ms 296 KB Output is correct
20 Correct 1 ms 280 KB Output is correct
21 Correct 1 ms 340 KB Output is correct
22 Correct 1 ms 304 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 300 KB Output is correct
27 Correct 1 ms 340 KB Output is correct
28 Correct 4 ms 516 KB Output is correct
29 Correct 2 ms 340 KB Output is correct
30 Correct 1 ms 340 KB Output is correct
31 Correct 2 ms 340 KB Output is correct
32 Correct 3 ms 340 KB Output is correct
33 Correct 3 ms 468 KB Output is correct
34 Correct 3 ms 436 KB Output is correct
35 Correct 4 ms 428 KB Output is correct
36 Correct 2 ms 428 KB Output is correct
37 Correct 2 ms 340 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 308 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 308 KB Output is correct
4 Correct 1 ms 300 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 2 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 1 ms 308 KB Output is correct
12 Correct 1 ms 212 KB Output is correct
13 Correct 1 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 308 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Correct 1 ms 304 KB Output is correct
19 Correct 1 ms 296 KB Output is correct
20 Correct 1 ms 280 KB Output is correct
21 Correct 1 ms 340 KB Output is correct
22 Correct 1 ms 304 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 300 KB Output is correct
27 Correct 1 ms 340 KB Output is correct
28 Correct 4 ms 516 KB Output is correct
29 Correct 2 ms 340 KB Output is correct
30 Correct 1 ms 340 KB Output is correct
31 Correct 2 ms 340 KB Output is correct
32 Correct 3 ms 340 KB Output is correct
33 Correct 3 ms 468 KB Output is correct
34 Correct 3 ms 436 KB Output is correct
35 Correct 4 ms 428 KB Output is correct
36 Correct 2 ms 428 KB Output is correct
37 Correct 2 ms 340 KB Output is correct
38 Correct 17 ms 2132 KB Output is correct
39 Correct 3 ms 468 KB Output is correct
40 Correct 3 ms 468 KB Output is correct
41 Correct 10 ms 960 KB Output is correct
42 Correct 7 ms 852 KB Output is correct
43 Correct 11 ms 1616 KB Output is correct
44 Correct 16 ms 2112 KB Output is correct
45 Correct 18 ms 2224 KB Output is correct
46 Correct 15 ms 1972 KB Output is correct
47 Correct 9 ms 1364 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 724 KB Output is correct
2 Correct 9 ms 1244 KB Output is correct
3 Correct 10 ms 1200 KB Output is correct
4 Correct 2 ms 468 KB Output is correct
5 Correct 4 ms 724 KB Output is correct
6 Correct 10 ms 1108 KB Output is correct
7 Correct 10 ms 1120 KB Output is correct
8 Correct 2 ms 468 KB Output is correct
9 Correct 3 ms 724 KB Output is correct
10 Correct 8 ms 1068 KB Output is correct
11 Correct 10 ms 1220 KB Output is correct
12 Correct 10 ms 1196 KB Output is correct
13 Correct 7 ms 980 KB Output is correct
14 Correct 3 ms 436 KB Output is correct
15 Correct 3 ms 688 KB Output is correct
16 Correct 8 ms 1108 KB Output is correct
17 Correct 10 ms 1236 KB Output is correct
18 Correct 9 ms 1272 KB Output is correct
19 Correct 7 ms 980 KB Output is correct
20 Correct 2 ms 468 KB Output is correct
21 Correct 1 ms 212 KB Output is correct
22 Correct 1 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 5 ms 752 KB Output is correct
4 Correct 8 ms 912 KB Output is correct
5 Correct 7 ms 980 KB Output is correct
6 Correct 7 ms 852 KB Output is correct
7 Correct 4 ms 596 KB Output is correct
8 Correct 9 ms 1064 KB Output is correct
9 Correct 12 ms 1500 KB Output is correct
10 Correct 14 ms 1620 KB Output is correct
11 Correct 11 ms 1364 KB Output is correct
12 Correct 8 ms 852 KB Output is correct
13 Correct 3 ms 724 KB Output is correct
14 Correct 9 ms 1108 KB Output is correct
15 Correct 9 ms 1060 KB Output is correct
16 Correct 2 ms 468 KB Output is correct
17 Correct 3 ms 724 KB Output is correct
18 Correct 10 ms 1236 KB Output is correct
19 Correct 2 ms 468 KB Output is correct
20 Correct 22 ms 2680 KB Output is correct
21 Correct 36 ms 4108 KB Output is correct
22 Correct 38 ms 3964 KB Output is correct
23 Correct 21 ms 2308 KB Output is correct
24 Correct 23 ms 2688 KB Output is correct
25 Correct 40 ms 4284 KB Output is correct
26 Correct 19 ms 2308 KB Output is correct
27 Correct 45 ms 4876 KB Output is correct
28 Correct 62 ms 7048 KB Output is correct
29 Correct 71 ms 7748 KB Output is correct
30 Correct 68 ms 6908 KB Output is correct
31 Correct 40 ms 4360 KB Output is correct
32 Correct 1 ms 212 KB Output is correct
33 Correct 1 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 40 ms 4856 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 4 ms 724 KB Output is correct
4 Correct 8 ms 1104 KB Output is correct
5 Correct 3 ms 724 KB Output is correct
6 Correct 3 ms 724 KB Output is correct
7 Correct 20 ms 2652 KB Output is correct
8 Correct 21 ms 2680 KB Output is correct
9 Correct 43 ms 4796 KB Output is correct
10 Correct 1 ms 304 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 308 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 308 KB Output is correct
4 Correct 1 ms 300 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 2 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 1 ms 308 KB Output is correct
12 Correct 1 ms 212 KB Output is correct
13 Correct 1 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 308 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Correct 1 ms 304 KB Output is correct
19 Correct 1 ms 296 KB Output is correct
20 Correct 1 ms 280 KB Output is correct
21 Correct 1 ms 340 KB Output is correct
22 Correct 1 ms 304 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 300 KB Output is correct
27 Correct 1 ms 340 KB Output is correct
28 Correct 4 ms 516 KB Output is correct
29 Correct 2 ms 340 KB Output is correct
30 Correct 1 ms 340 KB Output is correct
31 Correct 2 ms 340 KB Output is correct
32 Correct 3 ms 340 KB Output is correct
33 Correct 3 ms 468 KB Output is correct
34 Correct 3 ms 436 KB Output is correct
35 Correct 4 ms 428 KB Output is correct
36 Correct 2 ms 428 KB Output is correct
37 Correct 2 ms 340 KB Output is correct
38 Correct 17 ms 2132 KB Output is correct
39 Correct 3 ms 468 KB Output is correct
40 Correct 3 ms 468 KB Output is correct
41 Correct 10 ms 960 KB Output is correct
42 Correct 7 ms 852 KB Output is correct
43 Correct 11 ms 1616 KB Output is correct
44 Correct 16 ms 2112 KB Output is correct
45 Correct 18 ms 2224 KB Output is correct
46 Correct 15 ms 1972 KB Output is correct
47 Correct 9 ms 1364 KB Output is correct
48 Correct 3 ms 724 KB Output is correct
49 Correct 9 ms 1244 KB Output is correct
50 Correct 10 ms 1200 KB Output is correct
51 Correct 2 ms 468 KB Output is correct
52 Correct 4 ms 724 KB Output is correct
53 Correct 10 ms 1108 KB Output is correct
54 Correct 10 ms 1120 KB Output is correct
55 Correct 2 ms 468 KB Output is correct
56 Correct 3 ms 724 KB Output is correct
57 Correct 8 ms 1068 KB Output is correct
58 Correct 10 ms 1220 KB Output is correct
59 Correct 10 ms 1196 KB Output is correct
60 Correct 7 ms 980 KB Output is correct
61 Correct 3 ms 436 KB Output is correct
62 Correct 3 ms 688 KB Output is correct
63 Correct 8 ms 1108 KB Output is correct
64 Correct 10 ms 1236 KB Output is correct
65 Correct 9 ms 1272 KB Output is correct
66 Correct 7 ms 980 KB Output is correct
67 Correct 2 ms 468 KB Output is correct
68 Correct 1 ms 212 KB Output is correct
69 Correct 1 ms 212 KB Output is correct
70 Correct 1 ms 212 KB Output is correct
71 Correct 1 ms 212 KB Output is correct
72 Correct 5 ms 752 KB Output is correct
73 Correct 8 ms 912 KB Output is correct
74 Correct 7 ms 980 KB Output is correct
75 Correct 7 ms 852 KB Output is correct
76 Correct 4 ms 596 KB Output is correct
77 Correct 9 ms 1064 KB Output is correct
78 Correct 12 ms 1500 KB Output is correct
79 Correct 14 ms 1620 KB Output is correct
80 Correct 11 ms 1364 KB Output is correct
81 Correct 8 ms 852 KB Output is correct
82 Correct 3 ms 724 KB Output is correct
83 Correct 9 ms 1108 KB Output is correct
84 Correct 9 ms 1060 KB Output is correct
85 Correct 2 ms 468 KB Output is correct
86 Correct 3 ms 724 KB Output is correct
87 Correct 10 ms 1236 KB Output is correct
88 Correct 2 ms 468 KB Output is correct
89 Correct 22 ms 2680 KB Output is correct
90 Correct 36 ms 4108 KB Output is correct
91 Correct 38 ms 3964 KB Output is correct
92 Correct 21 ms 2308 KB Output is correct
93 Correct 23 ms 2688 KB Output is correct
94 Correct 40 ms 4284 KB Output is correct
95 Correct 19 ms 2308 KB Output is correct
96 Correct 45 ms 4876 KB Output is correct
97 Correct 62 ms 7048 KB Output is correct
98 Correct 71 ms 7748 KB Output is correct
99 Correct 68 ms 6908 KB Output is correct
100 Correct 40 ms 4360 KB Output is correct
101 Correct 1 ms 212 KB Output is correct
102 Correct 1 ms 212 KB Output is correct
103 Correct 40 ms 4856 KB Output is correct
104 Correct 1 ms 212 KB Output is correct
105 Correct 4 ms 724 KB Output is correct
106 Correct 8 ms 1104 KB Output is correct
107 Correct 3 ms 724 KB Output is correct
108 Correct 3 ms 724 KB Output is correct
109 Correct 20 ms 2652 KB Output is correct
110 Correct 21 ms 2680 KB Output is correct
111 Correct 43 ms 4796 KB Output is correct
112 Correct 1 ms 304 KB Output is correct
113 Correct 1 ms 212 KB Output is correct
114 Correct 69 ms 7036 KB Output is correct
115 Correct 2 ms 468 KB Output is correct
116 Correct 4 ms 688 KB Output is correct
117 Correct 28 ms 3284 KB Output is correct
118 Correct 29 ms 3576 KB Output is correct
119 Correct 74 ms 7600 KB Output is correct
120 Correct 72 ms 7684 KB Output is correct
121 Correct 76 ms 7652 KB Output is correct
122 Correct 67 ms 7640 KB Output is correct
123 Correct 38 ms 4836 KB Output is correct
124 Correct 82 ms 7048 KB Output is correct
125 Correct 67 ms 7684 KB Output is correct
126 Correct 68 ms 7724 KB Output is correct
127 Correct 57 ms 6868 KB Output is correct
128 Correct 36 ms 4356 KB Output is correct