답안 #1067073

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1067073 2024-08-20T10:40:08 Z TlenekWodoru Vision Program (IOI19_vision) C++17
100 / 100
20 ms 2140 KB
#include<bits/stdc++.h>
#include "vision.h"
using namespace std;
int n,m,k;
int Zero,Jeden,temp;
vector<int>A,An,A1,A2;
vector<int>B,Bn,B1,B2;
vector<int>P;
vector<int>V[4];
int Num(int y, int x)
{
    return y*m+x;
}
bool Bit(int x, int u)
{
    return (x>>u)%2;
}
vector<int>Add(vector<int>A,vector<int>B)
{
    const int siz=(int)A.size();
    int ziom=Zero;
    vector<int>W;
    for(int i=0;i<siz;i++)
    {
        int a=A[i],b=B[i],c=ziom;
        int xorr=add_xor({a,b,c});
        int andd=add_and({a,b,c});
        int orr=add_or({a,b,c});
        int Nxorr=add_not(xorr);
        int u1=andd,u2=add_and({orr,Nxorr});
        W.push_back(xorr);
        ziom=add_or({u1,u2});
    }
    return W;
}
void construct_network(int N, int M, int K)
{
    n=N;
    m=M;
    k=K;
    for(int i=0;i<n;i++)
    {
        P.clear();
        for(int j=0;j<m;j++)
        {
            P.push_back(Num(i,j));
        }
        A.push_back(add_or(P));
    }
    for(int i=0;i<m;i++)
    {
        P.clear();
        for(int j=0;j<n;j++)
        {
            P.push_back(Num(j,i));
        }
        B.push_back(add_or(P));
    }
    temp=add_not(0);
    Jeden=add_or({0,temp});
    Zero=add_and({0,temp});
    An.resize(A.size());
    A1.resize(A.size());
    A2.resize(A.size());
    Bn.resize(B.size());
    B1.resize(B.size());
    B2.resize(B.size());
    for(int i=0;i<(int)A.size();i++)
    {
        An[i]=add_not(A[i]);
    }
    for(int i=0;i<(int)B.size();i++)
    {
        Bn[i]=add_not(B[i]);
    }
    P.clear();
    for(int i=0;i<(int)A.size();i++)
    {
        P.push_back(A[i]);
        A1[i]=add_and(P);
        P.pop_back();
        P.push_back(An[i]);
    }
    P.clear();
    for(int i=(int)A.size()-1;i>=0;i--)
    {
        P.push_back(A[i]);
        A2[i]=add_and(P);
        P.pop_back();
        P.push_back(An[i]);
    }
    P.clear();
    for(int i=0;i<(int)B.size();i++)
    {
        P.push_back(B[i]);
        B1[i]=add_and(P);
        P.pop_back();
        P.push_back(Bn[i]);
    }
    P.clear();
    for(int i=(int)B.size()-1;i>=0;i--)
    {
        P.push_back(B[i]);
        B2[i]=add_and(P);
        P.pop_back();
        P.push_back(Bn[i]);
    }
    for(int i=0;i<4;i++)
    {
        V[i].resize(10);
    }
    for(int i=0;i<10;i++)
    {
        P.clear();
        for(int j=0;j<n;j++)
        {
            if(Bit(j,i)==0){continue;}
            P.push_back(A1[j]);
        }
        if((int)P.size()==0){V[0][i]=Jeden;}
        else
        {
            temp=add_or(P);
            V[0][i]=add_not(temp);
        }
        P.clear();
        for(int j=0;j<n;j++)
        {
            if(Bit(j,i)==0){continue;}
            P.push_back(A2[j]);
        }
        if((int)P.size()==0){V[1][i]=Zero;}
        else
        {
            V[1][i]=add_or(P);
        }
        P.clear();
        for(int j=0;j<m;j++)
        {
            if(Bit(j,i)==0){continue;}
            P.push_back(B1[j]);
        }
        if((int)P.size()==0){V[2][i]=Jeden;}
        else
        {
            temp=add_or(P);
            V[2][i]=add_not(temp);
        }
        P.clear();
        for(int j=0;j<m;j++)
        {
            if(Bit(j,i)==0){continue;}
            P.push_back(B2[j]);
        }
        if((int)P.size()==0){V[3][i]=Zero;}
        else
        {
            V[3][i]=add_or(P);
        }
    }
    V[0]=Add(V[0],V[1]);
    V[0]=Add(V[0],V[2]);
    V[0]=Add(V[0],V[3]);
    k=(k-2+1024)%1024;
    P.clear();
    for(int i=0;i<10;i++)
    {
        if(Bit(k,i)){P.push_back(V[0][i]);}
        else{P.push_back(add_not(V[0][i]));}
    }
    add_and(P);
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
19 Correct 0 ms 348 KB Output is correct
20 Correct 0 ms 348 KB Output is correct
21 Correct 0 ms 348 KB Output is correct
22 Correct 0 ms 348 KB Output is correct
23 Correct 0 ms 348 KB Output is correct
24 Correct 1 ms 344 KB Output is correct
25 Correct 0 ms 344 KB Output is correct
26 Correct 0 ms 348 KB Output is correct
27 Correct 0 ms 436 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
19 Correct 0 ms 348 KB Output is correct
20 Correct 0 ms 348 KB Output is correct
21 Correct 0 ms 348 KB Output is correct
22 Correct 0 ms 348 KB Output is correct
23 Correct 0 ms 348 KB Output is correct
24 Correct 1 ms 344 KB Output is correct
25 Correct 0 ms 344 KB Output is correct
26 Correct 0 ms 348 KB Output is correct
27 Correct 0 ms 436 KB Output is correct
28 Correct 1 ms 348 KB Output is correct
29 Correct 0 ms 348 KB Output is correct
30 Correct 1 ms 348 KB Output is correct
31 Correct 1 ms 348 KB Output is correct
32 Correct 1 ms 348 KB Output is correct
33 Correct 1 ms 348 KB Output is correct
34 Correct 1 ms 348 KB Output is correct
35 Correct 1 ms 348 KB Output is correct
36 Correct 1 ms 348 KB Output is correct
37 Correct 1 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
19 Correct 0 ms 348 KB Output is correct
20 Correct 0 ms 348 KB Output is correct
21 Correct 0 ms 348 KB Output is correct
22 Correct 0 ms 348 KB Output is correct
23 Correct 0 ms 348 KB Output is correct
24 Correct 1 ms 344 KB Output is correct
25 Correct 0 ms 344 KB Output is correct
26 Correct 0 ms 348 KB Output is correct
27 Correct 0 ms 436 KB Output is correct
28 Correct 1 ms 348 KB Output is correct
29 Correct 0 ms 348 KB Output is correct
30 Correct 1 ms 348 KB Output is correct
31 Correct 1 ms 348 KB Output is correct
32 Correct 1 ms 348 KB Output is correct
33 Correct 1 ms 348 KB Output is correct
34 Correct 1 ms 348 KB Output is correct
35 Correct 1 ms 348 KB Output is correct
36 Correct 1 ms 348 KB Output is correct
37 Correct 1 ms 348 KB Output is correct
38 Correct 6 ms 860 KB Output is correct
39 Correct 1 ms 348 KB Output is correct
40 Correct 2 ms 344 KB Output is correct
41 Correct 2 ms 604 KB Output is correct
42 Correct 4 ms 604 KB Output is correct
43 Correct 3 ms 860 KB Output is correct
44 Correct 3 ms 860 KB Output is correct
45 Correct 3 ms 860 KB Output is correct
46 Correct 3 ms 860 KB Output is correct
47 Correct 3 ms 860 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 604 KB Output is correct
2 Correct 3 ms 604 KB Output is correct
3 Correct 3 ms 604 KB Output is correct
4 Correct 2 ms 740 KB Output is correct
5 Correct 3 ms 692 KB Output is correct
6 Correct 4 ms 604 KB Output is correct
7 Correct 3 ms 604 KB Output is correct
8 Correct 6 ms 860 KB Output is correct
9 Correct 3 ms 604 KB Output is correct
10 Correct 6 ms 600 KB Output is correct
11 Correct 3 ms 604 KB Output is correct
12 Correct 3 ms 604 KB Output is correct
13 Correct 5 ms 604 KB Output is correct
14 Correct 3 ms 600 KB Output is correct
15 Correct 3 ms 600 KB Output is correct
16 Correct 3 ms 604 KB Output is correct
17 Correct 3 ms 604 KB Output is correct
18 Correct 5 ms 604 KB Output is correct
19 Correct 3 ms 600 KB Output is correct
20 Correct 3 ms 604 KB Output is correct
21 Correct 1 ms 348 KB Output is correct
22 Correct 1 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 3 ms 604 KB Output is correct
4 Correct 3 ms 600 KB Output is correct
5 Correct 1 ms 604 KB Output is correct
6 Correct 1 ms 604 KB Output is correct
7 Correct 1 ms 604 KB Output is correct
8 Correct 2 ms 604 KB Output is correct
9 Correct 4 ms 604 KB Output is correct
10 Correct 3 ms 604 KB Output is correct
11 Correct 2 ms 604 KB Output is correct
12 Correct 5 ms 604 KB Output is correct
13 Correct 2 ms 604 KB Output is correct
14 Correct 3 ms 600 KB Output is correct
15 Correct 3 ms 600 KB Output is correct
16 Correct 3 ms 604 KB Output is correct
17 Correct 3 ms 600 KB Output is correct
18 Correct 3 ms 768 KB Output is correct
19 Correct 3 ms 604 KB Output is correct
20 Correct 5 ms 1372 KB Output is correct
21 Correct 10 ms 1340 KB Output is correct
22 Correct 6 ms 1368 KB Output is correct
23 Correct 7 ms 1372 KB Output is correct
24 Correct 5 ms 1232 KB Output is correct
25 Correct 7 ms 1372 KB Output is correct
26 Correct 6 ms 1372 KB Output is correct
27 Correct 9 ms 2140 KB Output is correct
28 Correct 9 ms 2136 KB Output is correct
29 Correct 9 ms 2140 KB Output is correct
30 Correct 9 ms 2140 KB Output is correct
31 Correct 9 ms 2136 KB Output is correct
32 Correct 0 ms 348 KB Output is correct
33 Correct 0 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 20 ms 2128 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 440 KB Output is correct
4 Correct 2 ms 604 KB Output is correct
5 Correct 3 ms 604 KB Output is correct
6 Correct 3 ms 604 KB Output is correct
7 Correct 6 ms 1624 KB Output is correct
8 Correct 6 ms 1372 KB Output is correct
9 Correct 9 ms 2140 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
19 Correct 0 ms 348 KB Output is correct
20 Correct 0 ms 348 KB Output is correct
21 Correct 0 ms 348 KB Output is correct
22 Correct 0 ms 348 KB Output is correct
23 Correct 0 ms 348 KB Output is correct
24 Correct 1 ms 344 KB Output is correct
25 Correct 0 ms 344 KB Output is correct
26 Correct 0 ms 348 KB Output is correct
27 Correct 0 ms 436 KB Output is correct
28 Correct 1 ms 348 KB Output is correct
29 Correct 0 ms 348 KB Output is correct
30 Correct 1 ms 348 KB Output is correct
31 Correct 1 ms 348 KB Output is correct
32 Correct 1 ms 348 KB Output is correct
33 Correct 1 ms 348 KB Output is correct
34 Correct 1 ms 348 KB Output is correct
35 Correct 1 ms 348 KB Output is correct
36 Correct 1 ms 348 KB Output is correct
37 Correct 1 ms 348 KB Output is correct
38 Correct 6 ms 860 KB Output is correct
39 Correct 1 ms 348 KB Output is correct
40 Correct 2 ms 344 KB Output is correct
41 Correct 2 ms 604 KB Output is correct
42 Correct 4 ms 604 KB Output is correct
43 Correct 3 ms 860 KB Output is correct
44 Correct 3 ms 860 KB Output is correct
45 Correct 3 ms 860 KB Output is correct
46 Correct 3 ms 860 KB Output is correct
47 Correct 3 ms 860 KB Output is correct
48 Correct 3 ms 604 KB Output is correct
49 Correct 3 ms 604 KB Output is correct
50 Correct 3 ms 604 KB Output is correct
51 Correct 2 ms 740 KB Output is correct
52 Correct 3 ms 692 KB Output is correct
53 Correct 4 ms 604 KB Output is correct
54 Correct 3 ms 604 KB Output is correct
55 Correct 6 ms 860 KB Output is correct
56 Correct 3 ms 604 KB Output is correct
57 Correct 6 ms 600 KB Output is correct
58 Correct 3 ms 604 KB Output is correct
59 Correct 3 ms 604 KB Output is correct
60 Correct 5 ms 604 KB Output is correct
61 Correct 3 ms 600 KB Output is correct
62 Correct 3 ms 600 KB Output is correct
63 Correct 3 ms 604 KB Output is correct
64 Correct 3 ms 604 KB Output is correct
65 Correct 5 ms 604 KB Output is correct
66 Correct 3 ms 600 KB Output is correct
67 Correct 3 ms 604 KB Output is correct
68 Correct 1 ms 348 KB Output is correct
69 Correct 1 ms 348 KB Output is correct
70 Correct 0 ms 348 KB Output is correct
71 Correct 0 ms 348 KB Output is correct
72 Correct 3 ms 604 KB Output is correct
73 Correct 3 ms 600 KB Output is correct
74 Correct 1 ms 604 KB Output is correct
75 Correct 1 ms 604 KB Output is correct
76 Correct 1 ms 604 KB Output is correct
77 Correct 2 ms 604 KB Output is correct
78 Correct 4 ms 604 KB Output is correct
79 Correct 3 ms 604 KB Output is correct
80 Correct 2 ms 604 KB Output is correct
81 Correct 5 ms 604 KB Output is correct
82 Correct 2 ms 604 KB Output is correct
83 Correct 3 ms 600 KB Output is correct
84 Correct 3 ms 600 KB Output is correct
85 Correct 3 ms 604 KB Output is correct
86 Correct 3 ms 600 KB Output is correct
87 Correct 3 ms 768 KB Output is correct
88 Correct 3 ms 604 KB Output is correct
89 Correct 5 ms 1372 KB Output is correct
90 Correct 10 ms 1340 KB Output is correct
91 Correct 6 ms 1368 KB Output is correct
92 Correct 7 ms 1372 KB Output is correct
93 Correct 5 ms 1232 KB Output is correct
94 Correct 7 ms 1372 KB Output is correct
95 Correct 6 ms 1372 KB Output is correct
96 Correct 9 ms 2140 KB Output is correct
97 Correct 9 ms 2136 KB Output is correct
98 Correct 9 ms 2140 KB Output is correct
99 Correct 9 ms 2140 KB Output is correct
100 Correct 9 ms 2136 KB Output is correct
101 Correct 0 ms 348 KB Output is correct
102 Correct 0 ms 348 KB Output is correct
103 Correct 20 ms 2128 KB Output is correct
104 Correct 0 ms 348 KB Output is correct
105 Correct 1 ms 440 KB Output is correct
106 Correct 2 ms 604 KB Output is correct
107 Correct 3 ms 604 KB Output is correct
108 Correct 3 ms 604 KB Output is correct
109 Correct 6 ms 1624 KB Output is correct
110 Correct 6 ms 1372 KB Output is correct
111 Correct 9 ms 2140 KB Output is correct
112 Correct 0 ms 348 KB Output is correct
113 Correct 0 ms 348 KB Output is correct
114 Correct 9 ms 2140 KB Output is correct
115 Correct 3 ms 604 KB Output is correct
116 Correct 3 ms 604 KB Output is correct
117 Correct 8 ms 1204 KB Output is correct
118 Correct 6 ms 1372 KB Output is correct
119 Correct 9 ms 2140 KB Output is correct
120 Correct 9 ms 2140 KB Output is correct
121 Correct 9 ms 2140 KB Output is correct
122 Correct 9 ms 2140 KB Output is correct
123 Correct 9 ms 2136 KB Output is correct
124 Correct 13 ms 2104 KB Output is correct
125 Correct 9 ms 2140 KB Output is correct
126 Correct 9 ms 2140 KB Output is correct
127 Correct 9 ms 2140 KB Output is correct
128 Correct 9 ms 2140 KB Output is correct