Submission #977147

# Submission time Handle Problem Language Result Execution time Memory
977147 2024-05-07T12:22:11 Z LucaIlie Vision Program (IOI19_vision) C++17
46 / 100
14 ms 1884 KB
#include "vision.h"
#include <bits/stdc++.h>

using namespace std;

const int MAX_N = 200;
int isOnLineId[MAX_N], isOnColumnId[MAX_N];
int isDifLineId[MAX_N], isDifColumnId[MAX_N];
int xorLineId[MAX_N], xorColumnId[MAX_N];

int n, m, k;

int cellId( int l, int c ) {
    if ( l < 0 || c < 0 || l >= n || c >= m )
        return -1;
    return l * m + c;
}

void construct_network( int N, int M, int K ) {
    n = N, m = M, k = K;

    int id = n * m;
    for ( int l = 0; l < n; l++ ) {
        vector<int> ids;
        for ( int c = 0; c < m; c++ )
            ids.push_back( cellId( l, c ) );
        add_or( ids );
        isOnLineId[l] = id;
        id++;
    }
    for ( int l = 0; l < n; l++ ) {
        vector<int> ids;
        for ( int c = 0; c < m; c++ )
            ids.push_back( cellId( l, c ) );
        add_xor( ids );
        xorLineId[l] = id;
        id++;
    }
    for ( int c = 0; c < m; c++ ) {
        vector<int> ids;
        for ( int l = 0; l < n; l++ )
            ids.push_back( cellId( l, c ) );
        add_or( ids );
        isOnColumnId[c] = id;
        id++;
    }
    for ( int c = 0; c < m; c++ ) {
        vector<int> ids;
        for ( int l = 0; l < n; l++ )
            ids.push_back( cellId( l, c ) );
        add_xor( ids );
        xorColumnId[c] = id;
        id++;
    }

    for ( int difL = 0; difL < n && difL <= k; difL++ ) {
        vector<int> ids;
        for ( int l = 0; l + difL < n; l++ ) {
            if ( difL == 0 )
                add_xor( { isOnLineId[l], xorLineId[l] } );
            else
                add_and( { isOnLineId[l], isOnLineId[l + difL] } );

            ids.push_back( id );
            id++;
        }
        add_or( ids );
        isDifLineId[difL] = id;
        id++;
    }
    for ( int difC = 0; difC < m && difC <= k; difC++ ) {
        vector<int> ids;
        for ( int c = 0; c + difC < m; c++ ) {
            if ( difC == 0 )
                add_xor( { isOnColumnId[c], xorColumnId[c] } );
            else
                add_and( { isOnColumnId[c], isOnColumnId[c + difC] } );

            ids.push_back( id );
            id++;
        }
        add_or( ids );
        isDifColumnId[difC] = id;
        id++;
    }

    vector<int> ids;
    for ( int i = 0; i <= k; i++ ) {
        if ( isDifLineId[i] == 0 || isDifColumnId[k - i] == 0 )
            continue;
        add_and( { isDifLineId[i], isDifColumnId[k - i] } );
        ids.push_back( id );
        id++;
    }

    add_or( ids );
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 440 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 600 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 1 ms 344 KB Output is correct
16 Correct 1 ms 348 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 1 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 440 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 600 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 1 ms 344 KB Output is correct
16 Correct 1 ms 348 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 1 ms 348 KB Output is correct
19 Correct 1 ms 348 KB Output is correct
20 Correct 1 ms 388 KB Output is correct
21 Correct 0 ms 348 KB Output is correct
22 Correct 1 ms 344 KB Output is correct
23 Correct 0 ms 348 KB Output is correct
24 Correct 1 ms 348 KB Output is correct
25 Correct 0 ms 348 KB Output is correct
26 Correct 0 ms 348 KB Output is correct
27 Correct 1 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 440 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 600 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 1 ms 344 KB Output is correct
16 Correct 1 ms 348 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 1 ms 348 KB Output is correct
19 Correct 1 ms 348 KB Output is correct
20 Correct 1 ms 388 KB Output is correct
21 Correct 0 ms 348 KB Output is correct
22 Correct 1 ms 344 KB Output is correct
23 Correct 0 ms 348 KB Output is correct
24 Correct 1 ms 348 KB Output is correct
25 Correct 0 ms 348 KB Output is correct
26 Correct 0 ms 348 KB Output is correct
27 Correct 1 ms 348 KB Output is correct
28 Correct 1 ms 348 KB Output is correct
29 Correct 1 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 344 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 604 KB Output is correct
37 Correct 1 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 440 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 600 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 1 ms 344 KB Output is correct
16 Correct 1 ms 348 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 1 ms 348 KB Output is correct
19 Correct 1 ms 348 KB Output is correct
20 Correct 1 ms 388 KB Output is correct
21 Correct 0 ms 348 KB Output is correct
22 Correct 1 ms 344 KB Output is correct
23 Correct 0 ms 348 KB Output is correct
24 Correct 1 ms 348 KB Output is correct
25 Correct 0 ms 348 KB Output is correct
26 Correct 0 ms 348 KB Output is correct
27 Correct 1 ms 348 KB Output is correct
28 Correct 1 ms 348 KB Output is correct
29 Correct 1 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 344 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 604 KB Output is correct
37 Correct 1 ms 348 KB Output is correct
38 Correct 7 ms 1492 KB Output is correct
39 Correct 2 ms 604 KB Output is correct
40 Correct 3 ms 728 KB Output is correct
41 Correct 3 ms 604 KB Output is correct
42 Correct 5 ms 980 KB Output is correct
43 Correct 5 ms 664 KB Output is correct
44 Correct 7 ms 1488 KB Output is correct
45 Incorrect 2 ms 1240 KB WA in grader: Too many instructions
46 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Incorrect 2 ms 1240 KB WA in grader: Too many instructions
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 2 ms 348 KB Output is correct
4 Correct 4 ms 604 KB Output is correct
5 Correct 4 ms 984 KB Output is correct
6 Correct 4 ms 980 KB Output is correct
7 Correct 4 ms 980 KB Output is correct
8 Correct 3 ms 604 KB Output is correct
9 Correct 5 ms 1028 KB Output is correct
10 Correct 7 ms 1240 KB Output is correct
11 Incorrect 2 ms 1240 KB WA in grader: Too many instructions
12 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 14 ms 1880 KB Output is correct
2 Correct 1 ms 344 KB Output is correct
3 Correct 2 ms 344 KB Output is correct
4 Correct 3 ms 604 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 7 ms 1112 KB Output is correct
8 Correct 7 ms 1116 KB Output is correct
9 Correct 14 ms 1884 KB Output is correct
10 Correct 1 ms 360 KB Output is correct
11 Correct 1 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 440 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 600 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 1 ms 344 KB Output is correct
16 Correct 1 ms 348 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 1 ms 348 KB Output is correct
19 Correct 1 ms 348 KB Output is correct
20 Correct 1 ms 388 KB Output is correct
21 Correct 0 ms 348 KB Output is correct
22 Correct 1 ms 344 KB Output is correct
23 Correct 0 ms 348 KB Output is correct
24 Correct 1 ms 348 KB Output is correct
25 Correct 0 ms 348 KB Output is correct
26 Correct 0 ms 348 KB Output is correct
27 Correct 1 ms 348 KB Output is correct
28 Correct 1 ms 348 KB Output is correct
29 Correct 1 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 344 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 604 KB Output is correct
37 Correct 1 ms 348 KB Output is correct
38 Correct 7 ms 1492 KB Output is correct
39 Correct 2 ms 604 KB Output is correct
40 Correct 3 ms 728 KB Output is correct
41 Correct 3 ms 604 KB Output is correct
42 Correct 5 ms 980 KB Output is correct
43 Correct 5 ms 664 KB Output is correct
44 Correct 7 ms 1488 KB Output is correct
45 Incorrect 2 ms 1240 KB WA in grader: Too many instructions
46 Halted 0 ms 0 KB -