Submission #290212

# Submission time Handle Problem Language Result Execution time Memory
290212 2020-09-03T13:45:19 Z rocks03 Vision Program (IOI19_vision) C++14
33 / 100
11 ms 1660 KB
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pld pair<long double, int>
#define pii pair<int, int>
#define pll pair<ll, ll>
#define pb push_back
#define ff first
#define ss second
#define SZ(x) ((int)(x).size())
#define ld long double
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

int add_and(vector<int> Ns);

int add_or(vector<int> Ns);

int add_xor(vector<int> Ns);

int add_not(int N);

int H, W;
bool valid(int x, int y){
    return (x >= 0 && x < H && y >= 0 && y < W);
}

map<pair<pii, pii>, int> m;
bool already(int i, int j, int i2, int j2){
    return (m.count({{i, j}, {i2, j2}}) || m.count({{i2, j2}, {i, j}}));
}

void construct_network(int H, int W, int K){
    ::H = H, ::W = W;
    vector<int> all;
    int cnt = 0;
    for(int i = 0; i < H; i++){
        for(int j = 0; j < W; j++){
            for(int k = 0; k <= K; k++){
                int i2 = i + k;
                int j2 = j + K - k;
                if(valid(i2, j2) && !already(i, j, i2, j2)){
                    vector<int> v(2);
                    v[0] = W*i + j;
                    v[1] = W*i2 + j2;
                    add_and(v);
                    all.pb(H*W+cnt);
                    cnt++;
                    m[{{i, j}, {i2, j2}}] = 1;
                }
                i2 = i + k;
                j2 = j - (K - k);
                if(valid(i2, j2) && !already(i, j, i2, j2)){
                    vector<int> v(2);
                    v[0] = W*i + j;
                    v[1] = W*i2 + j2;
                    add_and(v);
                    all.pb(H*W+cnt);
                    cnt++;
                    m[{{i, j}, {i2, j2}}] = 1;
                }
                i2 = i - k;
                j2 = j + K - k;
                if(valid(i2, j2) && !already(i, j, i2, j2)){
                    vector<int> v(2);
                    v[0] = W*i + j;
                    v[1] = W*i2 + j2;
                    add_and(v);
                    all.pb(H*W+cnt);
                    cnt++;
                    m[{{i, j}, {i2, j2}}] = 1;
                }
                i2 = i - k;
                j2 = j - (K - k);
                if(valid(i2, j2) && !already(i, j, i2, j2)){
                    vector<int> v(2);
                    v[0] = W*i + j;
                    v[1] = W*i2 + j2;
                    add_and(v);
                    all.pb(H*W+cnt);
                    cnt++;
                    m[{{i, j}, {i2, j2}}] = 1;
                }
            }
        }
    }
    add_or(all);
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 256 KB Output is correct
2 Correct 0 ms 256 KB Output is correct
3 Correct 1 ms 256 KB Output is correct
4 Correct 0 ms 256 KB Output is correct
5 Correct 0 ms 256 KB Output is correct
6 Correct 0 ms 256 KB Output is correct
7 Correct 1 ms 256 KB Output is correct
8 Correct 0 ms 256 KB Output is correct
9 Correct 1 ms 256 KB Output is correct
10 Correct 0 ms 256 KB Output is correct
11 Correct 0 ms 256 KB Output is correct
12 Correct 0 ms 256 KB Output is correct
13 Correct 0 ms 256 KB Output is correct
14 Correct 1 ms 256 KB Output is correct
15 Correct 0 ms 256 KB Output is correct
16 Correct 1 ms 256 KB Output is correct
17 Correct 0 ms 256 KB Output is correct
18 Correct 1 ms 256 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 256 KB Output is correct
2 Correct 0 ms 256 KB Output is correct
3 Correct 1 ms 256 KB Output is correct
4 Correct 0 ms 256 KB Output is correct
5 Correct 0 ms 256 KB Output is correct
6 Correct 0 ms 256 KB Output is correct
7 Correct 1 ms 256 KB Output is correct
8 Correct 0 ms 256 KB Output is correct
9 Correct 1 ms 256 KB Output is correct
10 Correct 0 ms 256 KB Output is correct
11 Correct 0 ms 256 KB Output is correct
12 Correct 0 ms 256 KB Output is correct
13 Correct 0 ms 256 KB Output is correct
14 Correct 1 ms 256 KB Output is correct
15 Correct 0 ms 256 KB Output is correct
16 Correct 1 ms 256 KB Output is correct
17 Correct 0 ms 256 KB Output is correct
18 Correct 1 ms 256 KB Output is correct
19 Correct 1 ms 256 KB Output is correct
20 Correct 1 ms 384 KB Output is correct
21 Correct 1 ms 384 KB Output is correct
22 Correct 1 ms 256 KB Output is correct
23 Correct 1 ms 384 KB Output is correct
24 Correct 1 ms 384 KB Output is correct
25 Correct 1 ms 416 KB Output is correct
26 Correct 1 ms 256 KB Output is correct
27 Correct 1 ms 256 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 256 KB Output is correct
2 Correct 0 ms 256 KB Output is correct
3 Correct 1 ms 256 KB Output is correct
4 Correct 0 ms 256 KB Output is correct
5 Correct 0 ms 256 KB Output is correct
6 Correct 0 ms 256 KB Output is correct
7 Correct 1 ms 256 KB Output is correct
8 Correct 0 ms 256 KB Output is correct
9 Correct 1 ms 256 KB Output is correct
10 Correct 0 ms 256 KB Output is correct
11 Correct 0 ms 256 KB Output is correct
12 Correct 0 ms 256 KB Output is correct
13 Correct 0 ms 256 KB Output is correct
14 Correct 1 ms 256 KB Output is correct
15 Correct 0 ms 256 KB Output is correct
16 Correct 1 ms 256 KB Output is correct
17 Correct 0 ms 256 KB Output is correct
18 Correct 1 ms 256 KB Output is correct
19 Correct 1 ms 256 KB Output is correct
20 Correct 1 ms 384 KB Output is correct
21 Correct 1 ms 384 KB Output is correct
22 Correct 1 ms 256 KB Output is correct
23 Correct 1 ms 384 KB Output is correct
24 Correct 1 ms 384 KB Output is correct
25 Correct 1 ms 416 KB Output is correct
26 Correct 1 ms 256 KB Output is correct
27 Correct 1 ms 256 KB Output is correct
28 Incorrect 8 ms 1660 KB WA in grader: Too many instructions
29 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 256 KB Output is correct
2 Correct 0 ms 256 KB Output is correct
3 Correct 1 ms 256 KB Output is correct
4 Correct 0 ms 256 KB Output is correct
5 Correct 0 ms 256 KB Output is correct
6 Correct 0 ms 256 KB Output is correct
7 Correct 1 ms 256 KB Output is correct
8 Correct 0 ms 256 KB Output is correct
9 Correct 1 ms 256 KB Output is correct
10 Correct 0 ms 256 KB Output is correct
11 Correct 0 ms 256 KB Output is correct
12 Correct 0 ms 256 KB Output is correct
13 Correct 0 ms 256 KB Output is correct
14 Correct 1 ms 256 KB Output is correct
15 Correct 0 ms 256 KB Output is correct
16 Correct 1 ms 256 KB Output is correct
17 Correct 0 ms 256 KB Output is correct
18 Correct 1 ms 256 KB Output is correct
19 Correct 1 ms 256 KB Output is correct
20 Correct 1 ms 384 KB Output is correct
21 Correct 1 ms 384 KB Output is correct
22 Correct 1 ms 256 KB Output is correct
23 Correct 1 ms 384 KB Output is correct
24 Correct 1 ms 384 KB Output is correct
25 Correct 1 ms 416 KB Output is correct
26 Correct 1 ms 256 KB Output is correct
27 Correct 1 ms 256 KB Output is correct
28 Incorrect 8 ms 1660 KB WA in grader: Too many instructions
29 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 384 KB Output is correct
2 Correct 1 ms 384 KB Output is correct
3 Correct 1 ms 384 KB Output is correct
4 Correct 1 ms 256 KB Output is correct
5 Correct 1 ms 384 KB Output is correct
6 Correct 1 ms 384 KB Output is correct
7 Correct 1 ms 384 KB Output is correct
8 Correct 1 ms 256 KB Output is correct
9 Correct 1 ms 384 KB Output is correct
10 Correct 1 ms 384 KB Output is correct
11 Correct 1 ms 384 KB Output is correct
12 Correct 1 ms 384 KB Output is correct
13 Correct 1 ms 256 KB Output is correct
14 Correct 1 ms 256 KB Output is correct
15 Correct 1 ms 384 KB Output is correct
16 Correct 1 ms 384 KB Output is correct
17 Correct 1 ms 384 KB Output is correct
18 Correct 1 ms 256 KB Output is correct
19 Correct 1 ms 256 KB Output is correct
20 Correct 1 ms 256 KB Output is correct
21 Correct 1 ms 256 KB Output is correct
22 Correct 0 ms 256 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 256 KB Output is correct
2 Correct 0 ms 256 KB Output is correct
3 Correct 10 ms 1252 KB Output is correct
4 Incorrect 6 ms 1660 KB WA in grader: Too many instructions
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 11 ms 1660 KB WA in grader: Too many instructions
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 256 KB Output is correct
2 Correct 0 ms 256 KB Output is correct
3 Correct 1 ms 256 KB Output is correct
4 Correct 0 ms 256 KB Output is correct
5 Correct 0 ms 256 KB Output is correct
6 Correct 0 ms 256 KB Output is correct
7 Correct 1 ms 256 KB Output is correct
8 Correct 0 ms 256 KB Output is correct
9 Correct 1 ms 256 KB Output is correct
10 Correct 0 ms 256 KB Output is correct
11 Correct 0 ms 256 KB Output is correct
12 Correct 0 ms 256 KB Output is correct
13 Correct 0 ms 256 KB Output is correct
14 Correct 1 ms 256 KB Output is correct
15 Correct 0 ms 256 KB Output is correct
16 Correct 1 ms 256 KB Output is correct
17 Correct 0 ms 256 KB Output is correct
18 Correct 1 ms 256 KB Output is correct
19 Correct 1 ms 256 KB Output is correct
20 Correct 1 ms 384 KB Output is correct
21 Correct 1 ms 384 KB Output is correct
22 Correct 1 ms 256 KB Output is correct
23 Correct 1 ms 384 KB Output is correct
24 Correct 1 ms 384 KB Output is correct
25 Correct 1 ms 416 KB Output is correct
26 Correct 1 ms 256 KB Output is correct
27 Correct 1 ms 256 KB Output is correct
28 Incorrect 8 ms 1660 KB WA in grader: Too many instructions
29 Halted 0 ms 0 KB -