답안 #259884

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
259884 2020-08-08T18:47:19 Z peti1234 Vision Program (IOI19_vision) C++17
100 / 100
225 ms 2004 KB
#include "vision.h"

#include <bits/stdc++.h>

using namespace std;
#define rep(n) for (int i=0; i<n; i++)
#define jrep(n) for (int j=0; j<n; j++)
bool valasz[50005];
const int c=402, f=399;
int pos, os[c], osk[c], oseg[c], kul[c], kulk[c], kseg[c], eos, ekul, van, s, nincs, rossz, db, p;
vector<int> sol;
void pb(int a) {
    sol.push_back(a);
}
int add(int a) {
    pos++;
    if (sol.size()==0) pb(rossz);
    if (a==1) add_or(sol);
    if (a==2) add_and(sol);
    if (a==3) add_xor(sol);
    if (a==4) add_not(p);

/*
    cout << sol.size() << " " << a << "\n";
    rep(sol.size()) cout << sol[i] << " ";
    cout << "\n";
*/
    if (a==4) valasz[pos]=!(valasz[p]);
    else {
        int si=sol.size(), db=0;
        rep(si) db+=valasz[sol[i]];
        if (a==1) valasz[pos]=(db>0);
        if (a==2) valasz[pos]=(db==si);
        if (a==3) valasz[pos]=(db%2);
    }
    sol.clear();
    return pos;
}
int solve(int k) {
    rep(f-k) {
        pb(eos), pb(osk[i]), pb(osk[i+k]);
        oseg[i]=add(2);
        pb(ekul), pb(kulk[i]), pb(kulk[i+k]);
        kseg[i]=add(2);
    }
    rep(f-k) pb(oseg[i]);
    oseg[0]=add(1);
    rep(f-k) pb(kseg[i]);
    kseg[0]=add(1);
    pb(oseg[0]), pb(kseg[0]);
    return add(1);
}
void construct_network(int n, int m, int k) {
    pos=n*m-1, db=n*m;
    rep(db) pb(i);
    rossz=add(3);
    rep(f) {
        int ert=i;
        rep(db) {
            int x=i/m, y=i%m;
            if (x+199-y==ert) pb(i);
        }
        kul[ert]=add(1);
        rep(db) {
            int x=i/m, y=i%m;
            if (x+y==ert) pb(i);
        }
        os[ert]=add(1);
        if (!i) kulk[i]=kul[i], osk[i]=os[i];
        else {
            pb(kulk[i-1]), pb(kul[i]);
            kulk[i]=add(3);
            pb(osk[i-1]), pb(os[i]);
            osk[i]=add(3);
        }
    }
    p=kulk[f-1], ekul=add(4);
    p=osk[f-1], eos=add(4);
    nincs=solve(k-1), van=solve(k);
    pb(van), pb(nincs);
    add(3);
}









/*
int b1, b2, b3, x, y;
int main()
{
    cin >> b1 >> b2 >> b3 >> x >> y;
    valasz[x]=1, valasz[y]=1;
    construct_network(b1, b2, b3);
    //rep(pos+1) cout << i << " " << valasz[i] << endl;
    cout << valasz[pos] << "\n";
    return 0;
}
*/
/*
1 26 24 1 25
*/
// prefix suffix 2-10 lehet 8 vagy 17 a függvény alapján
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 640 KB Output is correct
2 Correct 3 ms 640 KB Output is correct
3 Correct 3 ms 640 KB Output is correct
4 Correct 3 ms 640 KB Output is correct
5 Correct 3 ms 640 KB Output is correct
6 Correct 3 ms 640 KB Output is correct
7 Correct 3 ms 640 KB Output is correct
8 Correct 3 ms 640 KB Output is correct
9 Correct 3 ms 640 KB Output is correct
10 Correct 3 ms 640 KB Output is correct
11 Correct 3 ms 640 KB Output is correct
12 Correct 3 ms 640 KB Output is correct
13 Correct 3 ms 640 KB Output is correct
14 Correct 4 ms 640 KB Output is correct
15 Correct 3 ms 640 KB Output is correct
16 Correct 3 ms 640 KB Output is correct
17 Correct 4 ms 640 KB Output is correct
18 Correct 3 ms 640 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 640 KB Output is correct
2 Correct 3 ms 640 KB Output is correct
3 Correct 3 ms 640 KB Output is correct
4 Correct 3 ms 640 KB Output is correct
5 Correct 3 ms 640 KB Output is correct
6 Correct 3 ms 640 KB Output is correct
7 Correct 3 ms 640 KB Output is correct
8 Correct 3 ms 640 KB Output is correct
9 Correct 3 ms 640 KB Output is correct
10 Correct 3 ms 640 KB Output is correct
11 Correct 3 ms 640 KB Output is correct
12 Correct 3 ms 640 KB Output is correct
13 Correct 3 ms 640 KB Output is correct
14 Correct 4 ms 640 KB Output is correct
15 Correct 3 ms 640 KB Output is correct
16 Correct 3 ms 640 KB Output is correct
17 Correct 4 ms 640 KB Output is correct
18 Correct 3 ms 640 KB Output is correct
19 Correct 4 ms 640 KB Output is correct
20 Correct 3 ms 640 KB Output is correct
21 Correct 3 ms 640 KB Output is correct
22 Correct 3 ms 640 KB Output is correct
23 Correct 3 ms 640 KB Output is correct
24 Correct 3 ms 640 KB Output is correct
25 Correct 4 ms 640 KB Output is correct
26 Correct 4 ms 640 KB Output is correct
27 Correct 5 ms 640 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 640 KB Output is correct
2 Correct 3 ms 640 KB Output is correct
3 Correct 3 ms 640 KB Output is correct
4 Correct 3 ms 640 KB Output is correct
5 Correct 3 ms 640 KB Output is correct
6 Correct 3 ms 640 KB Output is correct
7 Correct 3 ms 640 KB Output is correct
8 Correct 3 ms 640 KB Output is correct
9 Correct 3 ms 640 KB Output is correct
10 Correct 3 ms 640 KB Output is correct
11 Correct 3 ms 640 KB Output is correct
12 Correct 3 ms 640 KB Output is correct
13 Correct 3 ms 640 KB Output is correct
14 Correct 4 ms 640 KB Output is correct
15 Correct 3 ms 640 KB Output is correct
16 Correct 3 ms 640 KB Output is correct
17 Correct 4 ms 640 KB Output is correct
18 Correct 3 ms 640 KB Output is correct
19 Correct 4 ms 640 KB Output is correct
20 Correct 3 ms 640 KB Output is correct
21 Correct 3 ms 640 KB Output is correct
22 Correct 3 ms 640 KB Output is correct
23 Correct 3 ms 640 KB Output is correct
24 Correct 3 ms 640 KB Output is correct
25 Correct 4 ms 640 KB Output is correct
26 Correct 4 ms 640 KB Output is correct
27 Correct 5 ms 640 KB Output is correct
28 Correct 7 ms 640 KB Output is correct
29 Correct 3 ms 640 KB Output is correct
30 Correct 3 ms 640 KB Output is correct
31 Correct 5 ms 640 KB Output is correct
32 Correct 6 ms 640 KB Output is correct
33 Correct 8 ms 640 KB Output is correct
34 Correct 7 ms 640 KB Output is correct
35 Correct 7 ms 640 KB Output is correct
36 Correct 8 ms 640 KB Output is correct
37 Correct 8 ms 640 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 640 KB Output is correct
2 Correct 3 ms 640 KB Output is correct
3 Correct 3 ms 640 KB Output is correct
4 Correct 3 ms 640 KB Output is correct
5 Correct 3 ms 640 KB Output is correct
6 Correct 3 ms 640 KB Output is correct
7 Correct 3 ms 640 KB Output is correct
8 Correct 3 ms 640 KB Output is correct
9 Correct 3 ms 640 KB Output is correct
10 Correct 3 ms 640 KB Output is correct
11 Correct 3 ms 640 KB Output is correct
12 Correct 3 ms 640 KB Output is correct
13 Correct 3 ms 640 KB Output is correct
14 Correct 4 ms 640 KB Output is correct
15 Correct 3 ms 640 KB Output is correct
16 Correct 3 ms 640 KB Output is correct
17 Correct 4 ms 640 KB Output is correct
18 Correct 3 ms 640 KB Output is correct
19 Correct 4 ms 640 KB Output is correct
20 Correct 3 ms 640 KB Output is correct
21 Correct 3 ms 640 KB Output is correct
22 Correct 3 ms 640 KB Output is correct
23 Correct 3 ms 640 KB Output is correct
24 Correct 3 ms 640 KB Output is correct
25 Correct 4 ms 640 KB Output is correct
26 Correct 4 ms 640 KB Output is correct
27 Correct 5 ms 640 KB Output is correct
28 Correct 7 ms 640 KB Output is correct
29 Correct 3 ms 640 KB Output is correct
30 Correct 3 ms 640 KB Output is correct
31 Correct 5 ms 640 KB Output is correct
32 Correct 6 ms 640 KB Output is correct
33 Correct 8 ms 640 KB Output is correct
34 Correct 7 ms 640 KB Output is correct
35 Correct 7 ms 640 KB Output is correct
36 Correct 8 ms 640 KB Output is correct
37 Correct 8 ms 640 KB Output is correct
38 Correct 56 ms 888 KB Output is correct
39 Correct 3 ms 640 KB Output is correct
40 Correct 3 ms 640 KB Output is correct
41 Correct 29 ms 760 KB Output is correct
42 Correct 28 ms 768 KB Output is correct
43 Correct 56 ms 888 KB Output is correct
44 Correct 55 ms 888 KB Output is correct
45 Correct 55 ms 888 KB Output is correct
46 Correct 55 ms 888 KB Output is correct
47 Correct 55 ms 888 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 640 KB Output is correct
2 Correct 3 ms 640 KB Output is correct
3 Correct 3 ms 640 KB Output is correct
4 Correct 3 ms 512 KB Output is correct
5 Correct 1 ms 640 KB Output is correct
6 Correct 4 ms 640 KB Output is correct
7 Correct 3 ms 640 KB Output is correct
8 Correct 3 ms 512 KB Output is correct
9 Correct 4 ms 640 KB Output is correct
10 Correct 3 ms 640 KB Output is correct
11 Correct 3 ms 640 KB Output is correct
12 Correct 3 ms 640 KB Output is correct
13 Correct 3 ms 640 KB Output is correct
14 Correct 3 ms 512 KB Output is correct
15 Correct 4 ms 640 KB Output is correct
16 Correct 3 ms 640 KB Output is correct
17 Correct 3 ms 640 KB Output is correct
18 Correct 4 ms 640 KB Output is correct
19 Correct 3 ms 640 KB Output is correct
20 Correct 3 ms 512 KB Output is correct
21 Correct 3 ms 640 KB Output is correct
22 Correct 2 ms 640 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 640 KB Output is correct
2 Correct 3 ms 640 KB Output is correct
3 Correct 18 ms 640 KB Output is correct
4 Correct 18 ms 768 KB Output is correct
5 Correct 18 ms 640 KB Output is correct
6 Correct 18 ms 640 KB Output is correct
7 Correct 18 ms 676 KB Output is correct
8 Correct 32 ms 760 KB Output is correct
9 Correct 33 ms 760 KB Output is correct
10 Correct 32 ms 760 KB Output is correct
11 Correct 32 ms 760 KB Output is correct
12 Correct 32 ms 768 KB Output is correct
13 Correct 3 ms 640 KB Output is correct
14 Correct 3 ms 640 KB Output is correct
15 Correct 3 ms 640 KB Output is correct
16 Correct 4 ms 512 KB Output is correct
17 Correct 4 ms 640 KB Output is correct
18 Correct 3 ms 640 KB Output is correct
19 Correct 4 ms 640 KB Output is correct
20 Correct 109 ms 1272 KB Output is correct
21 Correct 111 ms 1272 KB Output is correct
22 Correct 111 ms 1272 KB Output is correct
23 Correct 113 ms 1168 KB Output is correct
24 Correct 108 ms 1272 KB Output is correct
25 Correct 107 ms 1272 KB Output is correct
26 Correct 107 ms 1144 KB Output is correct
27 Correct 218 ms 2004 KB Output is correct
28 Correct 217 ms 1972 KB Output is correct
29 Correct 225 ms 1876 KB Output is correct
30 Correct 217 ms 1876 KB Output is correct
31 Correct 218 ms 1876 KB Output is correct
32 Correct 3 ms 640 KB Output is correct
33 Correct 3 ms 640 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 219 ms 1960 KB Output is correct
2 Correct 3 ms 640 KB Output is correct
3 Correct 20 ms 768 KB Output is correct
4 Correct 32 ms 768 KB Output is correct
5 Correct 3 ms 640 KB Output is correct
6 Correct 4 ms 640 KB Output is correct
7 Correct 110 ms 1272 KB Output is correct
8 Correct 108 ms 1272 KB Output is correct
9 Correct 218 ms 1992 KB Output is correct
10 Correct 3 ms 672 KB Output is correct
11 Correct 3 ms 640 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 640 KB Output is correct
2 Correct 3 ms 640 KB Output is correct
3 Correct 3 ms 640 KB Output is correct
4 Correct 3 ms 640 KB Output is correct
5 Correct 3 ms 640 KB Output is correct
6 Correct 3 ms 640 KB Output is correct
7 Correct 3 ms 640 KB Output is correct
8 Correct 3 ms 640 KB Output is correct
9 Correct 3 ms 640 KB Output is correct
10 Correct 3 ms 640 KB Output is correct
11 Correct 3 ms 640 KB Output is correct
12 Correct 3 ms 640 KB Output is correct
13 Correct 3 ms 640 KB Output is correct
14 Correct 4 ms 640 KB Output is correct
15 Correct 3 ms 640 KB Output is correct
16 Correct 3 ms 640 KB Output is correct
17 Correct 4 ms 640 KB Output is correct
18 Correct 3 ms 640 KB Output is correct
19 Correct 4 ms 640 KB Output is correct
20 Correct 3 ms 640 KB Output is correct
21 Correct 3 ms 640 KB Output is correct
22 Correct 3 ms 640 KB Output is correct
23 Correct 3 ms 640 KB Output is correct
24 Correct 3 ms 640 KB Output is correct
25 Correct 4 ms 640 KB Output is correct
26 Correct 4 ms 640 KB Output is correct
27 Correct 5 ms 640 KB Output is correct
28 Correct 7 ms 640 KB Output is correct
29 Correct 3 ms 640 KB Output is correct
30 Correct 3 ms 640 KB Output is correct
31 Correct 5 ms 640 KB Output is correct
32 Correct 6 ms 640 KB Output is correct
33 Correct 8 ms 640 KB Output is correct
34 Correct 7 ms 640 KB Output is correct
35 Correct 7 ms 640 KB Output is correct
36 Correct 8 ms 640 KB Output is correct
37 Correct 8 ms 640 KB Output is correct
38 Correct 56 ms 888 KB Output is correct
39 Correct 3 ms 640 KB Output is correct
40 Correct 3 ms 640 KB Output is correct
41 Correct 29 ms 760 KB Output is correct
42 Correct 28 ms 768 KB Output is correct
43 Correct 56 ms 888 KB Output is correct
44 Correct 55 ms 888 KB Output is correct
45 Correct 55 ms 888 KB Output is correct
46 Correct 55 ms 888 KB Output is correct
47 Correct 55 ms 888 KB Output is correct
48 Correct 4 ms 640 KB Output is correct
49 Correct 3 ms 640 KB Output is correct
50 Correct 3 ms 640 KB Output is correct
51 Correct 3 ms 512 KB Output is correct
52 Correct 1 ms 640 KB Output is correct
53 Correct 4 ms 640 KB Output is correct
54 Correct 3 ms 640 KB Output is correct
55 Correct 3 ms 512 KB Output is correct
56 Correct 4 ms 640 KB Output is correct
57 Correct 3 ms 640 KB Output is correct
58 Correct 3 ms 640 KB Output is correct
59 Correct 3 ms 640 KB Output is correct
60 Correct 3 ms 640 KB Output is correct
61 Correct 3 ms 512 KB Output is correct
62 Correct 4 ms 640 KB Output is correct
63 Correct 3 ms 640 KB Output is correct
64 Correct 3 ms 640 KB Output is correct
65 Correct 4 ms 640 KB Output is correct
66 Correct 3 ms 640 KB Output is correct
67 Correct 3 ms 512 KB Output is correct
68 Correct 3 ms 640 KB Output is correct
69 Correct 2 ms 640 KB Output is correct
70 Correct 3 ms 640 KB Output is correct
71 Correct 3 ms 640 KB Output is correct
72 Correct 18 ms 640 KB Output is correct
73 Correct 18 ms 768 KB Output is correct
74 Correct 18 ms 640 KB Output is correct
75 Correct 18 ms 640 KB Output is correct
76 Correct 18 ms 676 KB Output is correct
77 Correct 32 ms 760 KB Output is correct
78 Correct 33 ms 760 KB Output is correct
79 Correct 32 ms 760 KB Output is correct
80 Correct 32 ms 760 KB Output is correct
81 Correct 32 ms 768 KB Output is correct
82 Correct 3 ms 640 KB Output is correct
83 Correct 3 ms 640 KB Output is correct
84 Correct 3 ms 640 KB Output is correct
85 Correct 4 ms 512 KB Output is correct
86 Correct 4 ms 640 KB Output is correct
87 Correct 3 ms 640 KB Output is correct
88 Correct 4 ms 640 KB Output is correct
89 Correct 109 ms 1272 KB Output is correct
90 Correct 111 ms 1272 KB Output is correct
91 Correct 111 ms 1272 KB Output is correct
92 Correct 113 ms 1168 KB Output is correct
93 Correct 108 ms 1272 KB Output is correct
94 Correct 107 ms 1272 KB Output is correct
95 Correct 107 ms 1144 KB Output is correct
96 Correct 218 ms 2004 KB Output is correct
97 Correct 217 ms 1972 KB Output is correct
98 Correct 225 ms 1876 KB Output is correct
99 Correct 217 ms 1876 KB Output is correct
100 Correct 218 ms 1876 KB Output is correct
101 Correct 3 ms 640 KB Output is correct
102 Correct 3 ms 640 KB Output is correct
103 Correct 219 ms 1960 KB Output is correct
104 Correct 3 ms 640 KB Output is correct
105 Correct 20 ms 768 KB Output is correct
106 Correct 32 ms 768 KB Output is correct
107 Correct 3 ms 640 KB Output is correct
108 Correct 4 ms 640 KB Output is correct
109 Correct 110 ms 1272 KB Output is correct
110 Correct 108 ms 1272 KB Output is correct
111 Correct 218 ms 1992 KB Output is correct
112 Correct 3 ms 672 KB Output is correct
113 Correct 3 ms 640 KB Output is correct
114 Correct 218 ms 2004 KB Output is correct
115 Correct 3 ms 512 KB Output is correct
116 Correct 4 ms 640 KB Output is correct
117 Correct 111 ms 1272 KB Output is correct
118 Correct 108 ms 1264 KB Output is correct
119 Correct 216 ms 1884 KB Output is correct
120 Correct 216 ms 1880 KB Output is correct
121 Correct 215 ms 1876 KB Output is correct
122 Correct 216 ms 1880 KB Output is correct
123 Correct 218 ms 2004 KB Output is correct
124 Correct 218 ms 1864 KB Output is correct
125 Correct 218 ms 2004 KB Output is correct
126 Correct 220 ms 2004 KB Output is correct
127 Correct 216 ms 1748 KB Output is correct
128 Correct 216 ms 1748 KB Output is correct