Submission #293205

# Submission time Handle Problem Language Result Execution time Memory
293205 2020-09-07T18:28:02 Z muhammad_hokimiyon Vision Program (IOI19_vision) C++14
26 / 100
21 ms 2300 KB
#include "vision.h"
#include <bits/stdc++.h>

using namespace std;

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

int n,m;
int qur;
vector < int > g;
map < int , int > ll , rr;
map < int , vector < int > > l,r;

int o_r( vector < int > v )
{
    qur += 1;
    add_or( v );
    return qur;
}

int an_d( vector < int > v )
{
    qur += 1;
    add_and( v );
    return qur;
}

int xo_r( vector < int > v )
{
    qur += 1;
    add_xor( v );
    return qur;
}

int no_t( int x )
{
    qur += 1;
    add_not( x );
    return qur;
}

int foo( int k )
{
    vector < int > g,ff;
    for( int i = -(n + m); i <= n + m; i++ ){
        bool f = true;
        vector < int > ask;
        for( int j = i; j <= i + k; j++ ){
            if( l[j].empty() ){
                f = false;
                break;
            }
            assert( ll.find(j) != ll.end() );
            ask.push_back( ll[j] );
        }
        if( !f )continue;
        assert( (int)ask.size() == k + 1 );
        int x = o_r( ask );
        int y = xo_r( ask );
        int z = no_t( y );
        g.push_back( an_d( {x , z} ) );
    }
    for( int i = -(n + m); i <= n + m; i++ ){
        bool f = true;
        vector < int > ask;
        for( int j = i; j <= i + k; j++ ){
            if( r[j].empty() ){
                f = false;
                break;
            }
            assert( rr.find(j) != rr.end() );
            ask.push_back( rr[j] );
        }
        if( !f )continue;
        assert( (int)ask.size() == k + 1 );
        int x = o_r( ask );
        int y = xo_r( ask );
        int z = no_t( y );
        ff.push_back( an_d( {x , z} ) );
    }
    return an_d( { o_r( g ), o_r( ff ) } );
}

void construct_network(int H, int W, int K)
{
    n = H;
    m = W;
    qur = n * m - 1;
    for( int i = 0; i < n; i++ ){
        for( int j = 0; j < m; j++ ){
            int x = i - j , y = i + j;
            l[x].push_back(i * m + j);
            r[y].push_back(i * m + j);
        }
    }
    for( int i = -(n + m); i <= n + m; i++ ){
        if( l[i].empty() )continue;
        int x = o_r(l[i]);
        ll[i] = x;
    }
    for( int i = -(n + m); i <= n + m; i++ ){
        if( r[i].empty() )continue;
        int x = o_r( r[i] );
        rr[i] = x;
    }
    int x = foo( K );
    int y = foo( K - 1 );
    y = no_t( y );
    vector < int > f;
    f.push_back(x);
    f.push_back(y);
    an_d(f);
}
# 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 384 KB Output is correct
5 Correct 1 ms 384 KB Output is correct
6 Incorrect 1 ms 384 KB on inputs (0, 1), (1, 0), expected 1, but computed 0
7 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 384 KB Output is correct
5 Correct 1 ms 384 KB Output is correct
6 Incorrect 1 ms 384 KB on inputs (0, 1), (1, 0), expected 1, but computed 0
7 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 384 KB Output is correct
5 Correct 1 ms 384 KB Output is correct
6 Incorrect 1 ms 384 KB on inputs (0, 1), (1, 0), expected 1, but computed 0
7 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 384 KB Output is correct
5 Correct 1 ms 384 KB Output is correct
6 Incorrect 1 ms 384 KB on inputs (0, 1), (1, 0), expected 1, but computed 0
7 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 4 ms 640 KB Output is correct
2 Correct 15 ms 1152 KB Output is correct
3 Correct 17 ms 1152 KB Output is correct
4 Correct 7 ms 512 KB Output is correct
5 Correct 3 ms 768 KB Output is correct
6 Correct 17 ms 1280 KB Output is correct
7 Correct 17 ms 1152 KB Output is correct
8 Correct 8 ms 512 KB Output is correct
9 Correct 3 ms 768 KB Output is correct
10 Correct 11 ms 1152 KB Output is correct
11 Correct 15 ms 1152 KB Output is correct
12 Correct 15 ms 1152 KB Output is correct
13 Correct 13 ms 1004 KB Output is correct
14 Correct 7 ms 512 KB Output is correct
15 Correct 4 ms 640 KB Output is correct
16 Correct 12 ms 1152 KB Output is correct
17 Correct 15 ms 1152 KB Output is correct
18 Correct 15 ms 1152 KB Output is correct
19 Correct 15 ms 1024 KB Output is correct
20 Correct 7 ms 512 KB Output is correct
21 Correct 1 ms 384 KB Output is correct
22 Correct 0 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 384 KB Output is correct
2 Incorrect 0 ms 384 KB on inputs (0, 0), (1, 1), expected 1, but computed 0
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 21 ms 2292 KB Output is correct
2 Correct 0 ms 256 KB Output is correct
3 Correct 3 ms 640 KB Output is correct
4 Correct 5 ms 896 KB Output is correct
5 Correct 3 ms 768 KB Output is correct
6 Correct 4 ms 640 KB Output is correct
7 Correct 11 ms 1536 KB Output is correct
8 Correct 12 ms 1536 KB Output is correct
9 Correct 19 ms 2300 KB Output is correct
10 Correct 1 ms 256 KB Output is correct
11 Correct 0 ms 256 KB Output is correct
# 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 384 KB Output is correct
5 Correct 1 ms 384 KB Output is correct
6 Incorrect 1 ms 384 KB on inputs (0, 1), (1, 0), expected 1, but computed 0
7 Halted 0 ms 0 KB -