Submission #560781

# Submission time Handle Problem Language Result Execution time Memory
560781 2022-05-12T02:30:06 Z fcmalkcin Vision Program (IOI19_vision) C++17
100 / 100
69 ms 29288 KB
#include<bits/stdc++.h>
using namespace std;

#define ll int
#define pll pair<ll,ll>
#define ff first
#define ss second
//#define endl "\n"
#define pb push_back
#define F(i,a,b) for(ll i=a;i<=b;i++)

const ll maxn=5e5+100;
const ll base=1000;
const ll mod= 1e9+7 ;

mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());

/// i believe myself
/// goal 2/8
#include "vision.h"

vector<ll> gr[maxn];
vector<ll> gr1[maxn];
ll n, m;
ll cnt;
ll get(ll i,ll j)
{
    return i*m+j;
}
void chk(ll k)
{
    ll p=n*m-1;
    ll len=n+m-1;
    vector<ll> vtl;
    vector<ll> vtr;
    for (int i=0;i+k-1<=n+m-2;i++)
    {
        ll j=i+k-1;
        vector<ll> vt;
        vector<ll> vt1;
        for (int t=i;t<=j;t++)
        {
            vt.pb(p+t+1);
            vt1.pb(p+len+t+1);
        }
        add_or(vt);
        cnt++;
        add_xor(vt1);
        cnt++;
        add_not(cnt);
        cnt++;
        vector<ll> vtp;
        vtp.pb(cnt);
        vtp.pb(cnt-2);
        add_and(vtp);
        cnt++;
        vtl.pb(cnt);
    }
     for (int i=0;i+k-1<=n+m-2;i++)
    {
        ll j=i+k-1;
        vector<ll> vt,vt1;
        for (int t=i;t<=j;t++)
        {
            vt.pb(p+2*len+t+1);
            vt1.pb(p+3*len+t+1);
        }
         add_or(vt);
        cnt++;
        add_xor(vt1);
        cnt++;
        add_not(cnt);
        cnt++;
        vector<ll> vtp;
        vtp.pb(cnt);
        vtp.pb(cnt-2);
        add_and(vtp);
        cnt++;
        vtr.pb(cnt);
    }
    add_or(vtl);
    cnt++;
    add_or(vtr);
    cnt++;
    vector<ll> res;
    res.pb(cnt-1);
    res.pb(cnt);
    add_and(res);
    cnt++;
}
void construct_network(int H, int W, int K)
{
    n=H;
    m=W;
    ll k=K;
    for(int i=0;i<n;i++)
    {
        for (int j=0;j<m;j++)
        {
            gr[i+j].pb(get(i,j));
            gr1[i-j+m-1].pb(get(i,j));
        }
    }
    cnt=n*m-1;
    for (int i=0;i<=n+m-2;i++)
    {
        add_or(gr[i]);
    }
    for (int i=0;i<=n+m-2;i++)
    {
        add_xor(gr[i]);
    }
      for (int i=0;i<=n+m-2;i++)
    {
        add_or(gr1[i]);
    }
    for (int i=0;i<=n+m-2;i++)
    {
        add_xor(gr1[i]);
    }
     ll len=n+m-1;
    cnt+=(4*len);
    vector<ll> res;
    chk(k+1);
    res.pb(cnt);
    chk(k);
    add_not(cnt);
    cnt++;
    res.pb(cnt);
    add_and(res);
}
/*int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    if (fopen("t.inp","r"))
    {
        freopen("test.inp","r",stdin);
        freopen("test.out","w",stdout);
    }
}*/

# Verdict Execution time Memory Grader output
1 Correct 11 ms 23764 KB Output is correct
2 Correct 14 ms 23856 KB Output is correct
3 Correct 12 ms 23708 KB Output is correct
4 Correct 11 ms 23796 KB Output is correct
5 Correct 12 ms 23828 KB Output is correct
6 Correct 12 ms 23788 KB Output is correct
7 Correct 12 ms 23684 KB Output is correct
8 Correct 13 ms 23744 KB Output is correct
9 Correct 12 ms 23764 KB Output is correct
10 Correct 12 ms 23704 KB Output is correct
11 Correct 13 ms 23708 KB Output is correct
12 Correct 12 ms 23772 KB Output is correct
13 Correct 12 ms 23764 KB Output is correct
14 Correct 12 ms 23764 KB Output is correct
15 Correct 12 ms 23796 KB Output is correct
16 Correct 11 ms 23768 KB Output is correct
17 Correct 13 ms 23668 KB Output is correct
18 Correct 13 ms 23764 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 11 ms 23764 KB Output is correct
2 Correct 14 ms 23856 KB Output is correct
3 Correct 12 ms 23708 KB Output is correct
4 Correct 11 ms 23796 KB Output is correct
5 Correct 12 ms 23828 KB Output is correct
6 Correct 12 ms 23788 KB Output is correct
7 Correct 12 ms 23684 KB Output is correct
8 Correct 13 ms 23744 KB Output is correct
9 Correct 12 ms 23764 KB Output is correct
10 Correct 12 ms 23704 KB Output is correct
11 Correct 13 ms 23708 KB Output is correct
12 Correct 12 ms 23772 KB Output is correct
13 Correct 12 ms 23764 KB Output is correct
14 Correct 12 ms 23764 KB Output is correct
15 Correct 12 ms 23796 KB Output is correct
16 Correct 11 ms 23768 KB Output is correct
17 Correct 13 ms 23668 KB Output is correct
18 Correct 13 ms 23764 KB Output is correct
19 Correct 13 ms 23892 KB Output is correct
20 Correct 13 ms 23792 KB Output is correct
21 Correct 12 ms 23764 KB Output is correct
22 Correct 13 ms 23784 KB Output is correct
23 Correct 14 ms 23792 KB Output is correct
24 Correct 13 ms 23764 KB Output is correct
25 Correct 12 ms 23764 KB Output is correct
26 Correct 13 ms 23736 KB Output is correct
27 Correct 13 ms 23800 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 11 ms 23764 KB Output is correct
2 Correct 14 ms 23856 KB Output is correct
3 Correct 12 ms 23708 KB Output is correct
4 Correct 11 ms 23796 KB Output is correct
5 Correct 12 ms 23828 KB Output is correct
6 Correct 12 ms 23788 KB Output is correct
7 Correct 12 ms 23684 KB Output is correct
8 Correct 13 ms 23744 KB Output is correct
9 Correct 12 ms 23764 KB Output is correct
10 Correct 12 ms 23704 KB Output is correct
11 Correct 13 ms 23708 KB Output is correct
12 Correct 12 ms 23772 KB Output is correct
13 Correct 12 ms 23764 KB Output is correct
14 Correct 12 ms 23764 KB Output is correct
15 Correct 12 ms 23796 KB Output is correct
16 Correct 11 ms 23768 KB Output is correct
17 Correct 13 ms 23668 KB Output is correct
18 Correct 13 ms 23764 KB Output is correct
19 Correct 13 ms 23892 KB Output is correct
20 Correct 13 ms 23792 KB Output is correct
21 Correct 12 ms 23764 KB Output is correct
22 Correct 13 ms 23784 KB Output is correct
23 Correct 14 ms 23792 KB Output is correct
24 Correct 13 ms 23764 KB Output is correct
25 Correct 12 ms 23764 KB Output is correct
26 Correct 13 ms 23736 KB Output is correct
27 Correct 13 ms 23800 KB Output is correct
28 Correct 14 ms 23924 KB Output is correct
29 Correct 13 ms 23768 KB Output is correct
30 Correct 13 ms 23764 KB Output is correct
31 Correct 12 ms 23800 KB Output is correct
32 Correct 12 ms 23876 KB Output is correct
33 Correct 13 ms 23924 KB Output is correct
34 Correct 14 ms 23924 KB Output is correct
35 Correct 13 ms 23892 KB Output is correct
36 Correct 13 ms 23800 KB Output is correct
37 Correct 13 ms 23808 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 11 ms 23764 KB Output is correct
2 Correct 14 ms 23856 KB Output is correct
3 Correct 12 ms 23708 KB Output is correct
4 Correct 11 ms 23796 KB Output is correct
5 Correct 12 ms 23828 KB Output is correct
6 Correct 12 ms 23788 KB Output is correct
7 Correct 12 ms 23684 KB Output is correct
8 Correct 13 ms 23744 KB Output is correct
9 Correct 12 ms 23764 KB Output is correct
10 Correct 12 ms 23704 KB Output is correct
11 Correct 13 ms 23708 KB Output is correct
12 Correct 12 ms 23772 KB Output is correct
13 Correct 12 ms 23764 KB Output is correct
14 Correct 12 ms 23764 KB Output is correct
15 Correct 12 ms 23796 KB Output is correct
16 Correct 11 ms 23768 KB Output is correct
17 Correct 13 ms 23668 KB Output is correct
18 Correct 13 ms 23764 KB Output is correct
19 Correct 13 ms 23892 KB Output is correct
20 Correct 13 ms 23792 KB Output is correct
21 Correct 12 ms 23764 KB Output is correct
22 Correct 13 ms 23784 KB Output is correct
23 Correct 14 ms 23792 KB Output is correct
24 Correct 13 ms 23764 KB Output is correct
25 Correct 12 ms 23764 KB Output is correct
26 Correct 13 ms 23736 KB Output is correct
27 Correct 13 ms 23800 KB Output is correct
28 Correct 14 ms 23924 KB Output is correct
29 Correct 13 ms 23768 KB Output is correct
30 Correct 13 ms 23764 KB Output is correct
31 Correct 12 ms 23800 KB Output is correct
32 Correct 12 ms 23876 KB Output is correct
33 Correct 13 ms 23924 KB Output is correct
34 Correct 14 ms 23924 KB Output is correct
35 Correct 13 ms 23892 KB Output is correct
36 Correct 13 ms 23800 KB Output is correct
37 Correct 13 ms 23808 KB Output is correct
38 Correct 22 ms 25044 KB Output is correct
39 Correct 15 ms 24020 KB Output is correct
40 Correct 14 ms 23968 KB Output is correct
41 Correct 16 ms 24276 KB Output is correct
42 Correct 15 ms 24020 KB Output is correct
43 Correct 18 ms 24544 KB Output is correct
44 Correct 24 ms 25080 KB Output is correct
45 Correct 30 ms 25128 KB Output is correct
46 Correct 23 ms 24924 KB Output is correct
47 Correct 19 ms 24368 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 14 ms 24020 KB Output is correct
2 Correct 20 ms 24532 KB Output is correct
3 Correct 21 ms 24556 KB Output is correct
4 Correct 14 ms 23764 KB Output is correct
5 Correct 14 ms 24052 KB Output is correct
6 Correct 19 ms 24564 KB Output is correct
7 Correct 19 ms 24436 KB Output is correct
8 Correct 14 ms 23840 KB Output is correct
9 Correct 13 ms 24020 KB Output is correct
10 Correct 19 ms 24440 KB Output is correct
11 Correct 21 ms 24560 KB Output is correct
12 Correct 20 ms 24532 KB Output is correct
13 Correct 19 ms 24404 KB Output is correct
14 Correct 13 ms 23892 KB Output is correct
15 Correct 14 ms 24044 KB Output is correct
16 Correct 19 ms 24504 KB Output is correct
17 Correct 21 ms 24532 KB Output is correct
18 Correct 20 ms 24504 KB Output is correct
19 Correct 17 ms 24356 KB Output is correct
20 Correct 13 ms 23764 KB Output is correct
21 Correct 13 ms 23684 KB Output is correct
22 Correct 12 ms 23796 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 12 ms 23764 KB Output is correct
2 Correct 12 ms 23800 KB Output is correct
3 Correct 14 ms 24048 KB Output is correct
4 Correct 16 ms 24308 KB Output is correct
5 Correct 21 ms 24216 KB Output is correct
6 Correct 18 ms 24180 KB Output is correct
7 Correct 14 ms 23892 KB Output is correct
8 Correct 15 ms 24308 KB Output is correct
9 Correct 21 ms 24692 KB Output is correct
10 Correct 21 ms 24828 KB Output is correct
11 Correct 19 ms 24532 KB Output is correct
12 Correct 15 ms 24052 KB Output is correct
13 Correct 14 ms 24116 KB Output is correct
14 Correct 22 ms 24532 KB Output is correct
15 Correct 19 ms 24484 KB Output is correct
16 Correct 13 ms 23764 KB Output is correct
17 Correct 14 ms 24060 KB Output is correct
18 Correct 19 ms 24564 KB Output is correct
19 Correct 13 ms 23788 KB Output is correct
20 Correct 23 ms 25192 KB Output is correct
21 Correct 37 ms 26604 KB Output is correct
22 Correct 35 ms 26428 KB Output is correct
23 Correct 20 ms 24812 KB Output is correct
24 Correct 24 ms 25160 KB Output is correct
25 Correct 38 ms 26704 KB Output is correct
26 Correct 21 ms 24756 KB Output is correct
27 Correct 31 ms 26316 KB Output is correct
28 Correct 51 ms 28628 KB Output is correct
29 Correct 56 ms 29196 KB Output is correct
30 Correct 48 ms 28360 KB Output is correct
31 Correct 31 ms 25932 KB Output is correct
32 Correct 12 ms 23712 KB Output is correct
33 Correct 12 ms 23764 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 30 ms 26376 KB Output is correct
2 Correct 11 ms 23776 KB Output is correct
3 Correct 14 ms 24108 KB Output is correct
4 Correct 17 ms 24264 KB Output is correct
5 Correct 14 ms 24108 KB Output is correct
6 Correct 13 ms 24020 KB Output is correct
7 Correct 22 ms 25200 KB Output is correct
8 Correct 22 ms 25232 KB Output is correct
9 Correct 34 ms 26404 KB Output is correct
10 Correct 12 ms 23764 KB Output is correct
11 Correct 11 ms 23764 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 11 ms 23764 KB Output is correct
2 Correct 14 ms 23856 KB Output is correct
3 Correct 12 ms 23708 KB Output is correct
4 Correct 11 ms 23796 KB Output is correct
5 Correct 12 ms 23828 KB Output is correct
6 Correct 12 ms 23788 KB Output is correct
7 Correct 12 ms 23684 KB Output is correct
8 Correct 13 ms 23744 KB Output is correct
9 Correct 12 ms 23764 KB Output is correct
10 Correct 12 ms 23704 KB Output is correct
11 Correct 13 ms 23708 KB Output is correct
12 Correct 12 ms 23772 KB Output is correct
13 Correct 12 ms 23764 KB Output is correct
14 Correct 12 ms 23764 KB Output is correct
15 Correct 12 ms 23796 KB Output is correct
16 Correct 11 ms 23768 KB Output is correct
17 Correct 13 ms 23668 KB Output is correct
18 Correct 13 ms 23764 KB Output is correct
19 Correct 13 ms 23892 KB Output is correct
20 Correct 13 ms 23792 KB Output is correct
21 Correct 12 ms 23764 KB Output is correct
22 Correct 13 ms 23784 KB Output is correct
23 Correct 14 ms 23792 KB Output is correct
24 Correct 13 ms 23764 KB Output is correct
25 Correct 12 ms 23764 KB Output is correct
26 Correct 13 ms 23736 KB Output is correct
27 Correct 13 ms 23800 KB Output is correct
28 Correct 14 ms 23924 KB Output is correct
29 Correct 13 ms 23768 KB Output is correct
30 Correct 13 ms 23764 KB Output is correct
31 Correct 12 ms 23800 KB Output is correct
32 Correct 12 ms 23876 KB Output is correct
33 Correct 13 ms 23924 KB Output is correct
34 Correct 14 ms 23924 KB Output is correct
35 Correct 13 ms 23892 KB Output is correct
36 Correct 13 ms 23800 KB Output is correct
37 Correct 13 ms 23808 KB Output is correct
38 Correct 22 ms 25044 KB Output is correct
39 Correct 15 ms 24020 KB Output is correct
40 Correct 14 ms 23968 KB Output is correct
41 Correct 16 ms 24276 KB Output is correct
42 Correct 15 ms 24020 KB Output is correct
43 Correct 18 ms 24544 KB Output is correct
44 Correct 24 ms 25080 KB Output is correct
45 Correct 30 ms 25128 KB Output is correct
46 Correct 23 ms 24924 KB Output is correct
47 Correct 19 ms 24368 KB Output is correct
48 Correct 14 ms 24020 KB Output is correct
49 Correct 20 ms 24532 KB Output is correct
50 Correct 21 ms 24556 KB Output is correct
51 Correct 14 ms 23764 KB Output is correct
52 Correct 14 ms 24052 KB Output is correct
53 Correct 19 ms 24564 KB Output is correct
54 Correct 19 ms 24436 KB Output is correct
55 Correct 14 ms 23840 KB Output is correct
56 Correct 13 ms 24020 KB Output is correct
57 Correct 19 ms 24440 KB Output is correct
58 Correct 21 ms 24560 KB Output is correct
59 Correct 20 ms 24532 KB Output is correct
60 Correct 19 ms 24404 KB Output is correct
61 Correct 13 ms 23892 KB Output is correct
62 Correct 14 ms 24044 KB Output is correct
63 Correct 19 ms 24504 KB Output is correct
64 Correct 21 ms 24532 KB Output is correct
65 Correct 20 ms 24504 KB Output is correct
66 Correct 17 ms 24356 KB Output is correct
67 Correct 13 ms 23764 KB Output is correct
68 Correct 13 ms 23684 KB Output is correct
69 Correct 12 ms 23796 KB Output is correct
70 Correct 12 ms 23764 KB Output is correct
71 Correct 12 ms 23800 KB Output is correct
72 Correct 14 ms 24048 KB Output is correct
73 Correct 16 ms 24308 KB Output is correct
74 Correct 21 ms 24216 KB Output is correct
75 Correct 18 ms 24180 KB Output is correct
76 Correct 14 ms 23892 KB Output is correct
77 Correct 15 ms 24308 KB Output is correct
78 Correct 21 ms 24692 KB Output is correct
79 Correct 21 ms 24828 KB Output is correct
80 Correct 19 ms 24532 KB Output is correct
81 Correct 15 ms 24052 KB Output is correct
82 Correct 14 ms 24116 KB Output is correct
83 Correct 22 ms 24532 KB Output is correct
84 Correct 19 ms 24484 KB Output is correct
85 Correct 13 ms 23764 KB Output is correct
86 Correct 14 ms 24060 KB Output is correct
87 Correct 19 ms 24564 KB Output is correct
88 Correct 13 ms 23788 KB Output is correct
89 Correct 23 ms 25192 KB Output is correct
90 Correct 37 ms 26604 KB Output is correct
91 Correct 35 ms 26428 KB Output is correct
92 Correct 20 ms 24812 KB Output is correct
93 Correct 24 ms 25160 KB Output is correct
94 Correct 38 ms 26704 KB Output is correct
95 Correct 21 ms 24756 KB Output is correct
96 Correct 31 ms 26316 KB Output is correct
97 Correct 51 ms 28628 KB Output is correct
98 Correct 56 ms 29196 KB Output is correct
99 Correct 48 ms 28360 KB Output is correct
100 Correct 31 ms 25932 KB Output is correct
101 Correct 12 ms 23712 KB Output is correct
102 Correct 12 ms 23764 KB Output is correct
103 Correct 30 ms 26376 KB Output is correct
104 Correct 11 ms 23776 KB Output is correct
105 Correct 14 ms 24108 KB Output is correct
106 Correct 17 ms 24264 KB Output is correct
107 Correct 14 ms 24108 KB Output is correct
108 Correct 13 ms 24020 KB Output is correct
109 Correct 22 ms 25200 KB Output is correct
110 Correct 22 ms 25232 KB Output is correct
111 Correct 34 ms 26404 KB Output is correct
112 Correct 12 ms 23764 KB Output is correct
113 Correct 11 ms 23764 KB Output is correct
114 Correct 50 ms 28564 KB Output is correct
115 Correct 13 ms 23892 KB Output is correct
116 Correct 15 ms 24048 KB Output is correct
117 Correct 29 ms 25804 KB Output is correct
118 Correct 31 ms 26072 KB Output is correct
119 Correct 57 ms 29152 KB Output is correct
120 Correct 57 ms 29140 KB Output is correct
121 Correct 57 ms 29256 KB Output is correct
122 Correct 62 ms 29220 KB Output is correct
123 Correct 33 ms 26376 KB Output is correct
124 Correct 53 ms 28552 KB Output is correct
125 Correct 69 ms 29264 KB Output is correct
126 Correct 64 ms 29288 KB Output is correct
127 Correct 53 ms 28420 KB Output is correct
128 Correct 27 ms 25940 KB Output is correct