Submission #222583

# Submission time Handle Problem Language Result Execution time Memory
222583 2020-04-13T11:13:29 Z VEGAnn Vision Program (IOI19_vision) C++14
52 / 100
70 ms 5872 KB
#include <bits/stdc++.h>
#include "vision.h"
#define all(x) x.begin(),x.end()
#define sz(x) ((int)x.size())
#define pii pair<int,int>
#define ft first
#define sd second
#define MP make_pair
#define PB push_back
using namespace std;
const int N = 100100;
vector<int> vc, res, ids;
int n, m;

bool ok(int x, int y){
    return (x >= 0 && y >= 0 && x < n && y < m);
}

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

void construct_network(int H, int W, int K) {
    n = H; m = W;
    res.clear();

    if (max(H, W) > 100 && min(W, H) > 1){
        vc.clear();

        int i = 0, j = 0;
        int x = 0, y = -K;

        while (x != i - K){
            if (ok(x, y))
                vc.PB(x * m + y);

            x--; y++;
        }

        while (x != i){
            if (ok(x, y))
                vc.PB(x * m + y);

            x++; y++;
        }

        while (x != i + K){
            if (ok(x, y))
                vc.PB(x * m + y);

            x++; y--;
        }

        while (x != i){
            if (ok(x, y))
                vc.PB(x * m + y);

            x--; y--;
        }

        if (!sz(vc)) {
            add_and({0});
            return;
        }

        int id = add_or(vc);
        add_and({id, i * m + j});

        return;
    }

    ids.clear();

    for (int i = 0; i < n * m; i++)
        ids.PB(i);

    shuffle(all(ids), rnd);

    int kol = 0;

    for (int it = 0; it < n * m; it++){
        int i = ids[it] / m, j = ids[it] % m;

        vc.clear();

        int x = i, y = j - K;

        while (x != i - K){
            if (ok(x, y))
                vc.PB(x * m + y);

            x--; y++;
        }

        while (x != i){
            if (ok(x, y))
                vc.PB(x * m + y);

            x++; y++;
        }

        while (x != i + K){
            if (ok(x, y))
                vc.PB(x * m + y);

            x++; y--;
        }

        while (x != i){
            if (ok(x, y))
                vc.PB(x * m + y);

            x--; y--;
        }

        if (!sz(vc)) continue;

        int id = add_or(vc);
        res.PB(add_and({id, i * m + j}));

        kol += 2;

        if (kol + 3 > 10000)
            break;
    }

    add_or(res);
}
# Verdict Execution time Memory Grader output
1 Correct 5 ms 256 KB Output is correct
2 Correct 5 ms 384 KB Output is correct
3 Correct 4 ms 256 KB Output is correct
4 Correct 4 ms 256 KB Output is correct
5 Correct 5 ms 384 KB Output is correct
6 Correct 5 ms 384 KB Output is correct
7 Correct 4 ms 256 KB Output is correct
8 Correct 5 ms 384 KB Output is correct
9 Correct 4 ms 256 KB Output is correct
10 Correct 5 ms 256 KB Output is correct
11 Correct 5 ms 384 KB Output is correct
12 Correct 5 ms 256 KB Output is correct
13 Correct 4 ms 384 KB Output is correct
14 Correct 4 ms 256 KB Output is correct
15 Correct 5 ms 384 KB Output is correct
16 Correct 4 ms 384 KB Output is correct
17 Correct 5 ms 256 KB Output is correct
18 Correct 5 ms 256 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 256 KB Output is correct
2 Correct 5 ms 384 KB Output is correct
3 Correct 4 ms 256 KB Output is correct
4 Correct 4 ms 256 KB Output is correct
5 Correct 5 ms 384 KB Output is correct
6 Correct 5 ms 384 KB Output is correct
7 Correct 4 ms 256 KB Output is correct
8 Correct 5 ms 384 KB Output is correct
9 Correct 4 ms 256 KB Output is correct
10 Correct 5 ms 256 KB Output is correct
11 Correct 5 ms 384 KB Output is correct
12 Correct 5 ms 256 KB Output is correct
13 Correct 4 ms 384 KB Output is correct
14 Correct 4 ms 256 KB Output is correct
15 Correct 5 ms 384 KB Output is correct
16 Correct 4 ms 384 KB Output is correct
17 Correct 5 ms 256 KB Output is correct
18 Correct 5 ms 256 KB Output is correct
19 Correct 4 ms 256 KB Output is correct
20 Correct 4 ms 256 KB Output is correct
21 Correct 5 ms 256 KB Output is correct
22 Correct 4 ms 256 KB Output is correct
23 Correct 5 ms 384 KB Output is correct
24 Correct 5 ms 384 KB Output is correct
25 Correct 5 ms 384 KB Output is correct
26 Correct 5 ms 256 KB Output is correct
27 Correct 5 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 256 KB Output is correct
2 Correct 5 ms 384 KB Output is correct
3 Correct 4 ms 256 KB Output is correct
4 Correct 4 ms 256 KB Output is correct
5 Correct 5 ms 384 KB Output is correct
6 Correct 5 ms 384 KB Output is correct
7 Correct 4 ms 256 KB Output is correct
8 Correct 5 ms 384 KB Output is correct
9 Correct 4 ms 256 KB Output is correct
10 Correct 5 ms 256 KB Output is correct
11 Correct 5 ms 384 KB Output is correct
12 Correct 5 ms 256 KB Output is correct
13 Correct 4 ms 384 KB Output is correct
14 Correct 4 ms 256 KB Output is correct
15 Correct 5 ms 384 KB Output is correct
16 Correct 4 ms 384 KB Output is correct
17 Correct 5 ms 256 KB Output is correct
18 Correct 5 ms 256 KB Output is correct
19 Correct 4 ms 256 KB Output is correct
20 Correct 4 ms 256 KB Output is correct
21 Correct 5 ms 256 KB Output is correct
22 Correct 4 ms 256 KB Output is correct
23 Correct 5 ms 384 KB Output is correct
24 Correct 5 ms 384 KB Output is correct
25 Correct 5 ms 384 KB Output is correct
26 Correct 5 ms 256 KB Output is correct
27 Correct 5 ms 384 KB Output is correct
28 Correct 9 ms 768 KB Output is correct
29 Correct 5 ms 384 KB Output is correct
30 Correct 4 ms 256 KB Output is correct
31 Correct 5 ms 256 KB Output is correct
32 Correct 5 ms 384 KB Output is correct
33 Correct 6 ms 512 KB Output is correct
34 Correct 9 ms 640 KB Output is correct
35 Correct 8 ms 640 KB Output is correct
36 Correct 5 ms 384 KB Output is correct
37 Correct 5 ms 256 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 256 KB Output is correct
2 Correct 5 ms 384 KB Output is correct
3 Correct 4 ms 256 KB Output is correct
4 Correct 4 ms 256 KB Output is correct
5 Correct 5 ms 384 KB Output is correct
6 Correct 5 ms 384 KB Output is correct
7 Correct 4 ms 256 KB Output is correct
8 Correct 5 ms 384 KB Output is correct
9 Correct 4 ms 256 KB Output is correct
10 Correct 5 ms 256 KB Output is correct
11 Correct 5 ms 384 KB Output is correct
12 Correct 5 ms 256 KB Output is correct
13 Correct 4 ms 384 KB Output is correct
14 Correct 4 ms 256 KB Output is correct
15 Correct 5 ms 384 KB Output is correct
16 Correct 4 ms 384 KB Output is correct
17 Correct 5 ms 256 KB Output is correct
18 Correct 5 ms 256 KB Output is correct
19 Correct 4 ms 256 KB Output is correct
20 Correct 4 ms 256 KB Output is correct
21 Correct 5 ms 256 KB Output is correct
22 Correct 4 ms 256 KB Output is correct
23 Correct 5 ms 384 KB Output is correct
24 Correct 5 ms 384 KB Output is correct
25 Correct 5 ms 384 KB Output is correct
26 Correct 5 ms 256 KB Output is correct
27 Correct 5 ms 384 KB Output is correct
28 Correct 9 ms 768 KB Output is correct
29 Correct 5 ms 384 KB Output is correct
30 Correct 4 ms 256 KB Output is correct
31 Correct 5 ms 256 KB Output is correct
32 Correct 5 ms 384 KB Output is correct
33 Correct 6 ms 512 KB Output is correct
34 Correct 9 ms 640 KB Output is correct
35 Correct 8 ms 640 KB Output is correct
36 Correct 5 ms 384 KB Output is correct
37 Correct 5 ms 256 KB Output is correct
38 Incorrect 70 ms 5872 KB on inputs (58, 84), (89, 65), expected 1, but computed 0
39 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 5 ms 384 KB Output is correct
2 Correct 5 ms 384 KB Output is correct
3 Correct 5 ms 384 KB Output is correct
4 Correct 5 ms 256 KB Output is correct
5 Correct 5 ms 384 KB Output is correct
6 Correct 5 ms 384 KB Output is correct
7 Correct 5 ms 384 KB Output is correct
8 Correct 5 ms 384 KB Output is correct
9 Correct 5 ms 384 KB Output is correct
10 Correct 5 ms 384 KB Output is correct
11 Correct 5 ms 384 KB Output is correct
12 Correct 5 ms 384 KB Output is correct
13 Correct 5 ms 384 KB Output is correct
14 Correct 5 ms 256 KB Output is correct
15 Correct 5 ms 384 KB Output is correct
16 Correct 5 ms 384 KB Output is correct
17 Correct 5 ms 384 KB Output is correct
18 Correct 5 ms 384 KB Output is correct
19 Correct 5 ms 384 KB Output is correct
20 Correct 5 ms 384 KB Output is correct
21 Correct 4 ms 256 KB Output is correct
22 Correct 5 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 384 KB Output is correct
2 Correct 4 ms 256 KB Output is correct
3 Correct 5 ms 384 KB Output is correct
4 Correct 4 ms 256 KB Output is correct
5 Correct 5 ms 384 KB Output is correct
6 Correct 4 ms 256 KB Output is correct
7 Correct 5 ms 256 KB Output is correct
8 Correct 4 ms 256 KB Output is correct
9 Correct 4 ms 256 KB Output is correct
10 Correct 5 ms 384 KB Output is correct
11 Correct 4 ms 256 KB Output is correct
12 Correct 5 ms 384 KB Output is correct
13 Correct 12 ms 384 KB Output is correct
14 Correct 5 ms 384 KB Output is correct
15 Correct 5 ms 384 KB Output is correct
16 Correct 5 ms 256 KB Output is correct
17 Correct 5 ms 384 KB Output is correct
18 Correct 5 ms 384 KB Output is correct
19 Correct 5 ms 384 KB Output is correct
20 Correct 5 ms 384 KB Output is correct
21 Correct 4 ms 256 KB Output is correct
22 Correct 4 ms 256 KB Output is correct
23 Correct 4 ms 256 KB Output is correct
24 Correct 5 ms 256 KB Output is correct
25 Correct 4 ms 256 KB Output is correct
26 Correct 4 ms 256 KB Output is correct
27 Correct 5 ms 256 KB Output is correct
28 Correct 5 ms 256 KB Output is correct
29 Correct 4 ms 256 KB Output is correct
30 Correct 5 ms 256 KB Output is correct
31 Correct 5 ms 256 KB Output is correct
32 Correct 4 ms 384 KB Output is correct
33 Correct 4 ms 256 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 256 KB on inputs (80, 199), (81, 199), expected 1, but computed 0
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 5 ms 256 KB Output is correct
2 Correct 5 ms 384 KB Output is correct
3 Correct 4 ms 256 KB Output is correct
4 Correct 4 ms 256 KB Output is correct
5 Correct 5 ms 384 KB Output is correct
6 Correct 5 ms 384 KB Output is correct
7 Correct 4 ms 256 KB Output is correct
8 Correct 5 ms 384 KB Output is correct
9 Correct 4 ms 256 KB Output is correct
10 Correct 5 ms 256 KB Output is correct
11 Correct 5 ms 384 KB Output is correct
12 Correct 5 ms 256 KB Output is correct
13 Correct 4 ms 384 KB Output is correct
14 Correct 4 ms 256 KB Output is correct
15 Correct 5 ms 384 KB Output is correct
16 Correct 4 ms 384 KB Output is correct
17 Correct 5 ms 256 KB Output is correct
18 Correct 5 ms 256 KB Output is correct
19 Correct 4 ms 256 KB Output is correct
20 Correct 4 ms 256 KB Output is correct
21 Correct 5 ms 256 KB Output is correct
22 Correct 4 ms 256 KB Output is correct
23 Correct 5 ms 384 KB Output is correct
24 Correct 5 ms 384 KB Output is correct
25 Correct 5 ms 384 KB Output is correct
26 Correct 5 ms 256 KB Output is correct
27 Correct 5 ms 384 KB Output is correct
28 Correct 9 ms 768 KB Output is correct
29 Correct 5 ms 384 KB Output is correct
30 Correct 4 ms 256 KB Output is correct
31 Correct 5 ms 256 KB Output is correct
32 Correct 5 ms 384 KB Output is correct
33 Correct 6 ms 512 KB Output is correct
34 Correct 9 ms 640 KB Output is correct
35 Correct 8 ms 640 KB Output is correct
36 Correct 5 ms 384 KB Output is correct
37 Correct 5 ms 256 KB Output is correct
38 Incorrect 70 ms 5872 KB on inputs (58, 84), (89, 65), expected 1, but computed 0
39 Halted 0 ms 0 KB -