Submission #792800

# Submission time Handle Problem Language Result Execution time Memory
792800 2023-07-25T08:55:58 Z LucaIlie Airline Route Map (JOI18_airline) C++17
0 / 100
358 ms 13184 KB
#include "Alicelib.h"
#include <bits/stdc++.h>

using namespace std;

bool isMapEdge[2000][2000];

void addEdge( int u, int v ) {
    isMapEdge[u][v] = isMapEdge[v][u] = true;
}

void Alice( int n, int m, int a[], int b[] ){
    int V = n + 12;

    for ( int i = 0; i < m; i++ )
        addEdge( a[i], b[i] );

    int iden = n + 10, special = n + 11;
    for ( int u = 0; u < n + 9; u++ )
        addEdge( iden, u );

    for ( int u = n; u < n + 10; u++ )
        addEdge( special, u );
    for ( int u = n; u < n + 9; u++ )
        addEdge( u, u + 1 );

    for ( int u = 0; u < n; u++ ) {
        for ( int b = 0; b < 10; b++ ) {
            if ( (u >> b) & 1 )
                addEdge( u, n + b );
        }
    }

    int E = 0;
    for ( int u = 0; u < V; u++ ) {
        for ( int v = u + 1; v < V; v++ ) {
            if ( isMapEdge[u][v] )
                E++;
        }
    }
    InitG( V, E );
    int e = 0;
    for ( int u = 0; u < V; u++ ) {
        for ( int v = u + 1; v < V; v++ ) {
            if ( isMapEdge[u][v] )
                MakeG( e++, u, v );
        }
    }

    cout << "Alice: \n";
    for ( int u = 0; u < V; u++ ) {
        cout << u << " ";
        for ( int v = 0; v < V; v++ )
            cout << isMapEdge[u][v];
        cout << "\n";
    }
    cout << "\n\n\n";
}

#include "Boblib.h"
#include <bits/stdc++.h>

using namespace std;

bool isEdge[2000][2000], isNode[2000];
int bit[10], val[2000], vec[2000];
vector<int> bits;

void Bob( int V, int E, int a[], int b[] ){
    int n = V - 12;

    for ( int i = 0; i < E; i++ )
        isEdge[a[i]][b[i]] = isEdge[b[i]][a[i]] = true;
    cout << "Bob: \n";
    for ( int u = 0; u < V; u++ ) {
        cout << u << " ";
        for ( int v = 0; v < V; v++ )
            cout << isEdge[u][v];
        cout << "\n";
    }
    cout << "\n\n\n";

    int iden = -1, special = -1;
    for ( int u = 0; u < V; u++ ) {
        for ( int v = 0; v < V; v++ )
            vec[u] += isEdge[u][v];
        if ( vec[u] == V - 3 )
            iden = u;
        printf( "%d\n", vec[u] );
        E -= vec[u];
    }
    for ( int u = 0; u < V; u++ ) {
        if ( u == iden || isEdge[u][iden] )
            continue;
        if ( vec[u] == 10 )
            special = u;
        else
            bit[9] = u;
    }
    for ( int u = 0; u < V; u++ )
        isNode[u] = true;
    printf( "special %d\niden %d\nbit9 %d\n", special, iden, bit[9] );
    isNode[special] = isNode[iden] = false;
    for ( int u = 0; u < V; u++ ) {
        if ( isEdge[special][u] ) {
            bits.push_back( u );
            isNode[u] = false;
        }
    }
    for ( int b = 9; b >= 1; b-- ) {
        for ( int c: bits ) {
            if ( isEdge[bit[b]][c] && c != bit[b + 1] )
                bit[b - 1] = c;
        }
    }
    for ( int b = 8; b >= 0; b-- )
        printf( "bit%d %d\n", b, bit[b] );
    for ( int u = 0; u < V; u++ ) {
        if ( !isNode[u] )
            continue;
        val[u] = 0;
        for ( int b = 0; b < 10; b++ )
            val[u] += (isEdge[u][bit[b]] << b);
    }

    int m = 0;
    for ( int u = 0; u < V; u++ ) {
        for ( int v = u + 1; v < V; v++ ) {
            if ( isNode[u] && isNode[v] && isEdge[u][v] )
                m++, cout << val[u] << " " << val[v] << "\n";
        }
    }
    InitMap( n, m );
    for ( int u = 0; u < V; u++ ) {
        for ( int v = u + 1; v < V; v++ ) {
            if ( isNode[u] && isNode[v] && isEdge[u][v] )
                MakeMap( val[u], val[v] );
        }
    }
}

# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 3408 KB DO NOT PRINT ANYTHING TO STANDARD OUTPUT
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 3408 KB DO NOT PRINT ANYTHING TO STANDARD OUTPUT
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 358 ms 13184 KB Execution killed with signal 13
2 Halted 0 ms 0 KB -