Submission #483925

#TimeUsernameProblemLanguageResultExecution timeMemory
483925Lam_lai_cuoc_doiVision Program (IOI19_vision)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h>

using namespace std;
using ll = long long;
using ld = long double;
using ull = unsigned long long;

template <class T>
void read(T &x)
{
    x = 0;
    register int c;
    while ((c = getchar()) && (c > '9' || c < '0'))
        ;
    for (; c >= '0' && c <= '9'; c = getchar())
        x = x * 10 + c - '0';
}

constexpr bool typetest = 0;
constexpr int N = 2e2 + 5;

void construct_network(int H, int W, int K)
{
#define pos(x, y) (W * x + y)
    vector<int> r, c;

    for (int i = 0; i < H; ++i)
    {
        vector<int> tmp;
        for (int j = 0; j < W; ++j)
            tmp.emplace_back(pos(i, j));
        if (add_or(tmp))
            r.emplace_back(i);
    }

    for (int i = 0; i < W; ++i)
    {
        vector<int> tmp;
        for (int j = 0; j < H; ++j)
            tmp.emplace_back(pos(j, i));
        if (add_or(tmp))
            c.emplace_back(i);
    }

    if (r.size() == 1)
    {
        if (abs(c[0] - c[1]) == K)
            add_or({pos(r[0], c[0])});
        else
            add_not(pos(r[0], c[0]));
        return;
    }
    if (c.size() == 1)
    {
        if (abs(r[0] - r[1]) == K)
            add_or({pos(r[0], c[0])});
        else
            add_not(pos(r[0], c[0]));
        return;
    }

    if (!add_not(pos(r[0], c[0])))
    {
        if (abs(r[0] - r[1]) + abs(c[0] - c[1]) == K)
            add_or({pos(r[0], c[0])});
        else
            add_not(pos(r[0], c[0]));
    }
    else
    {
        if (abs(r[0] - r[1]) + abs(c[0] - c[1]) == K)
            add_or({pos(r[0], c[1])});
        else
            add_not(pos(r[0], c[1]));
    }
}
/*
void Read()
{
}

void Solve()
{
}

int32_t main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    if (fopen("palesta.INP", "r"))
    {
        freopen("paletsa.inp", "r", stdin);
        freopen("palesta.out", "w", stdout);
    }
    int t(1);
    if (typetest)
        cin >> t;
    for (int _ = 1; _ <= t; ++_)
    {
        // cout << "Case #" << _ << ": ";
        Read();
        Solve();
    }
    // cerr << "\nTime elapsed: " << 1000 * clock() / CLOCKS_PER_SEC << "ms\n";
}

/*
11
-1 4
-4 2
-5 0
0 0
-3 -2
1 -2
5 -2
2 -3
-1 -4
1 -4
3 -4
*/

Compilation message (stderr)

vision.cpp:108:1: warning: "/*" within comment [-Wcomment]
  108 | /*
      |  
vision.cpp: In function 'void read(T&)':
vision.cpp:12:18: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   12 |     register int c;
      |                  ^
vision.cpp: In function 'void construct_network(int, int, int)':
vision.cpp:32:13: error: 'add_or' was not declared in this scope
   32 |         if (add_or(tmp))
      |             ^~~~~~
vision.cpp:41:13: error: 'add_or' was not declared in this scope
   41 |         if (add_or(tmp))
      |             ^~~~~~
vision.cpp:48:13: error: 'add_or' was not declared in this scope
   48 |             add_or({pos(r[0], c[0])});
      |             ^~~~~~
vision.cpp:50:13: error: 'add_not' was not declared in this scope
   50 |             add_not(pos(r[0], c[0]));
      |             ^~~~~~~
vision.cpp:56:13: error: 'add_or' was not declared in this scope
   56 |             add_or({pos(r[0], c[0])});
      |             ^~~~~~
vision.cpp:58:13: error: 'add_not' was not declared in this scope
   58 |             add_not(pos(r[0], c[0]));
      |             ^~~~~~~
vision.cpp:62:10: error: 'add_not' was not declared in this scope
   62 |     if (!add_not(pos(r[0], c[0])))
      |          ^~~~~~~
vision.cpp:65:13: error: 'add_or' was not declared in this scope
   65 |             add_or({pos(r[0], c[0])});
      |             ^~~~~~
vision.cpp:72:13: error: 'add_or' was not declared in this scope
   72 |             add_or({pos(r[0], c[1])});
      |             ^~~~~~