Submission #283992

# Submission time Handle Problem Language Result Execution time Memory
283992 2020-08-26T10:45:07 Z kartel Vision Program (IOI19_vision) C++14
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
#include "grader.cpp"
//#include "vision.h"
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
#define in(x) freopen(x, "r", stdin)
#define out(x) freopen(x, "w", stdout)
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize("-O3")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("fast-math")
#pragma GCC optimize("no-stack-protector")
#define F first
#define S second
#define pb push_back
#define N +205
#define M ll(1e9 + 7)
#define sz(x) (int)x.size()
#define re return
#define oo ll(1e9)
#define el '\n'
#define Max_A int(1e9)
//#define el endl
#define pii pair <int, int>
#define piii pair <int, pair <int, int> >
#define psi pair <string, int>
#define err ld(1e-9)
#define Max_S int(3e6)
#define last(x) (x).back()
#define all(x) (x).begin(), (x).end()
#define allr(x) (x).rbegin(), (x).rend()
#define arr_all(x, n) (x + 1), (x + 1 + n)
#define vi vector<int>
using namespace std;
//using namespace __gnu_pbds;
//typedef tree <int, null_type, less_equal <int> , rb_tree_tag, tree_order_statistics_node_update> ordered_set;
typedef long long ll;
typedef long double ld;

int i, j;
int diag_r[2][N][N];
int diag_l[2][N][N];
int diag_R[N][2];
int diag_L[N][2];

void construct_network(int n, int m, int k)
{
    vi vc;
    int num = n * m;
    for (i = 0; i < n; i++)
      {
          int x = i;

          if (i == m)
            break;

          vc.pb(x * m + x);
      }

    add_or(vc);

    diag_r[0][0][0] = num++;
    diag_R[n - 1][0] = num - 1;

    for (i = 1; i < n; i++)
    {
        int x = i;
        int y = 0;

        vi vc;
        vc.clear();

        for (; x < n && y < m; x++, y++)
            vc.pb(x * m + y);

        add_or(vc);

        diag_r[0][i][0] = num++;
        diag_R[n - i - 1][0] = num - 1;
    }

    for (j = 1; j < m; j++)
    {
        int x = 0;
        int y = j;

        vi vc;
        vc.clear();

        for (; x < n && y < m; x++, y++)
            vc.pb(x * m + y);

        add_or(vc);

        diag_r[0][0][j] = num++;
        diag_R[n + j - 1][0] = num - 1;
    }

    //------------------

    int y = m - 1;

    for (i = 0; i < n && y >= 0; i++)
      {
          int x = i;

          vc.pb(x * m + y);
          y--;
      }

    add_or(vc);

    diag_l[0][0][m - 1] = num++;
    diag_L[n - 1][0] = num - 1;

    for (i = 1; i < n; i++)
    {
        int x = i;
        int y = m - 1;

        vi vc;
        vc.clear();

        for (; x < n && y >= 0; x++, y--)
            vc.pb(x * m + y);

        add_or(vc);

        diag_l[0][i][m - 1] = num++;
        diag_L[n - i - 1][0] = num - 1;
    }

    for (j = 0; j < m - 1; j++)
    {
        int x = 0;
        int y = j;

        vi vc;
        vc.clear();

        for (; x < n && y >= 0; x++, y--)
            vc.pb(x * m + y);

        add_or(vc);

        diag_l[0][0][j] = num++;
        diag_L[n + m - j - 2][0] = num - 1;
    }

    //-----------------------------------

    for (i = 0; i < n; i++)
      {
          int x = i;

          if (i < m)
            break;

          vc.pb(x * m + x);
      }
    vc.pb(diag_r[0][0][0]);

    add_xor(vc);

    diag_r[1][0][0] = num++;
    diag_R[n - 1][1] = num - 1;

    for (i = 1; i < n; i++)
    {
        int x = i;
        int y = 0;

        vi vc;
        vc.clear();

        for (; x < n && y < m; x++, y++)
            vc.pb(x * m + y);

        vc.pb(diag_r[0][i][0]);

        add_xor(vc);

        diag_r[1][i][0] = num++;
        diag_R[n - i - 1][1] = num - 1;
    }

    for (j = 1; j < m; j++)
    {
        int x = 0;
        int y = j;

        vi vc;
        vc.clear();

        for (; x < n && y < m; x++, y++)
            vc.pb(x * m + y);

        vc.pb(diag_r[0][0][j]);

        add_xor(vc);

        diag_r[1][0][j] = num++;
        diag_R[n + j - 1][1] = num - 1;
    }

    //--------------------------------

    y = m - 1;

    for (i = 0; i < n && y >= 0; i++)
      {
          int x = i;

          vc.pb(x * m + y);
          y--;
      }

    vc.pb(diag_l[0][0][m - 1]);

    add_xor(vc);

    diag_l[1][0][m - 1] = num++;
    diag_L[n - 1][1] = num - 1;

    for (i = 1; i < n; i++)
    {
        int x = i;
        int y = m - 1;

        vi vc;
        vc.clear();

        for (; x < n && y >= 0; x++, y--)
            vc.pb(x * m + y);

        vc.pb(diag_l[0][i][m - 1]);

        add_xor(vc);

        diag_l[1][i][m - 1] = num++;
        diag_L[n - i - 1][1] = num - 1;
    }

    for (j = 0; j < m - 1; j++)
    {
        int x = 0;
        int y = j;

        vi vc;
        vc.clear();

        for (; x < n && y >= 0; x++, y--)
            vc.pb(x * m + y);

        vc.pb(diag_l[0][0][j]);

        add_xor(vc);

        diag_l[1][0][j] = num++;
        diag_L[n + m - j - 2][1] = num - 1;
    }

    vi vec;

    for (i = 0; i <= n + m - 1 - k; i++)
    {
        vi vc;

        for (j = i; j <= i + k; j++)
        {
            vc.pb(diag_L[j][0]);
            vc.pb(diag_L[j][1]);
        }

        add_xor(vc);
        add_not(num++);

        vec.pb(num);
    }

    add_or(vec);

    int one = num++;

    vec.clear();

    for (i = 0; i <= n + m - 1 - k; i++)
    {
        vi vc;
        for (j = i; j <= i + k; j++)
        {
            vc.pb(diag_R[j][0]);
            vc.pb(diag_R[j][1]);
        }

        add_xor(vc);
        add_not(num++);

        vec.pb(num);
    }

    add_or(vec);

    int two = num++;
    vec.clear();
    vec.pb(two);
    vec.pb(one);

    add_and(vec);

    int fiv = num++;

    vec.clear();

    for (i = 0; i <= n + m - 1 - k + 1; i++)
    {
        vi vc;

        for (j = i; j <= i + k - 1; j++)
        {
            vc.pb(diag_L[j][0]);
            vc.pb(diag_L[j][1]);
        }

        add_xor(vc);
        add_not(num++);

        vec.pb(num);
    }

    add_or(vec);

    one = num++;

    vec.clear();

    for (i = 0; i <= n + m - 1 - k + 1; i++)
    {
        vi vc;
        for (j = i; j <= i + k - 1; j++)
        {
            vc.pb(diag_R[j][0]);
            vc.pb(diag_R[j][1]);
        }

        add_xor(vc);
        add_not(num++);

        vec.pb(num);
    }

    add_or(vec);

    two = num++;
    vec.clear();
    vec.pb(two);
    vec.pb(one);

    add_and(vec);

    int six = num++;

    vec.clear();
    vec.pb(fiv);
    vec.pb(six);

    add_xor(vec);

    int fst = num++;

    add_not(six);

    vec.pb(num++);
    vec.pb(fst);

    add_and(vec);

    return;
}

Compilation message

/tmp/ccf1ePKj.o: In function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'
/tmp/ccwoEoaG.o:vision.cpp:(.text.startup+0x0): first defined here
/tmp/ccf1ePKj.o: In function `add_not(int)':
grader.cpp:(.text+0x260): multiple definition of `add_not(int)'
/tmp/ccwoEoaG.o:vision.cpp:(.text+0x770): first defined here
/tmp/ccf1ePKj.o: In function `add_xor(std::vector<int, std::allocator<int> >)':
grader.cpp:(.text+0x430): multiple definition of `add_xor(std::vector<int, std::allocator<int> >)'
/tmp/ccwoEoaG.o:vision.cpp:(.text+0x5c0): first defined here
/tmp/ccf1ePKj.o: In function `add_and(std::vector<int, std::allocator<int> >)':
grader.cpp:(.text+0x5e0): multiple definition of `add_and(std::vector<int, std::allocator<int> >)'
/tmp/ccwoEoaG.o:vision.cpp:(.text+0x260): first defined here
/tmp/ccf1ePKj.o: In function `add_or(std::vector<int, std::allocator<int> >)':
grader.cpp:(.text+0x790): multiple definition of `add_or(std::vector<int, std::allocator<int> >)'
/tmp/ccwoEoaG.o:vision.cpp:(.text+0x410): first defined here
collect2: error: ld returned 1 exit status