답안 #296396

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
296396 2020-09-10T14:17:34 Z SamAnd Vision Program (IOI19_vision) C++17
0 / 100
245 ms 1152 KB
#include "vision.h"
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define m_p make_pair
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
typedef long long ll;
const int N = 202;

int n, m, k;

vector<int> solv125()
{
    vector<int> v;
    for (int x1 = 0; x1 < n; ++x1)
    {
        for (int y1_ = 0; y1_ < m; ++y1_)
        {
            for (int x2 = 0; x2 < n; ++x2)
            {
                for (int y2 = 0; y2 < m; ++y2)
                {
                    if (abs(x1 - x2) + abs(y1_ - y2) == k)
                    {
                        if (m_p(x1, y1_) < m_p(x2, y2))
                        {
                            v.push_back(add_and({x1 * m + y1_, x2 * m + y2}));
                        }
                    }
                }
            }
        }
    }
    add_or(v);
}

void solv6()
{
    vector<int> v;
    for (int x1 = 0; x1 < 1; ++x1)
    {
        for (int y1_ = 0; y1_ < 1; ++y1_)
        {
            for (int x2 = 0; x2 < n; ++x2)
            {
                for (int y2 = 0; y2 < m; ++y2)
                {
                    if (abs(x1 - x2) + abs(y1_ - y2) == k)
                    {
                        if (m_p(x1, y1_) < m_p(x2, y2))
                        {
                            v.push_back(add_and({x1 * m + y1_, x2 * m + y2}));
                        }
                    }
                }
            }
        }
    }
    add_or(v);
}

void solv()
{
    vector<int> t, s;
    for (int i = 0; i < n; ++i)
    {
        vector<int> v;
        for (int j = 0; j < m; ++j)
        {
            v.push_back(i * m + j);
        }
        t.push_back(add_or(v));
    }
    for (int j = 0; j < m; ++j)
    {
        vector<int> v;
        for (int i = 0; i < n; ++i)
        {
            v.push_back(i * m + j);
        }
        s.push_back(add_or(v));
    }

    vector<int> tt, ss;
    for (int d = 0; d < n; ++d)
    {
        if (d == 0)
        {
            vector<int> v;
            for (int i = 0; i < n; ++i)
                v.push_back(t[i]);
            tt.push_back(add_xor(v));
            continue;
        }
        vector<int> v;
        for (int i = 0; i + d < n; ++i)
        {
            v.push_back(add_and({t[i], t[i + d]}));
        }
        tt.push_back(add_or(v));
    }
    for (int d = 0; d < m; ++d)
    {
        if (d == 0)
        {
            vector<int> v;
            for (int i = 0; i < m; ++i)
                v.push_back(s[i]);
            ss.push_back(add_xor(v));
            continue;
        }
        vector<int> v;
        for (int i = 0; i + d < m; ++i)
        {
            v.push_back(add_and({s[i], s[i + d]}));
        }
        ss.push_back(add_or(v));
    }

    vector<int> v;
    for (int i = 0; i < n; ++i)
    {
        for (int j = 0; j < m; ++j)
        {
            if (i + j == k)
            {
                v.push_back(add_and({tt[i], ss[j]}));
            }
        }
    }
    add_or(v);
}

void construct_network(int H, int W, int K)
{
	n = H;
	m = W;
	k = K;

	solv125();
	return;

    if (max(n, m) <= 10 || min(n, m) == 1)
        solv125();
    else if (max(n, m) <= 30)
        solv();
    else
        solv6();
}

Compilation message

vision.cpp: In function 'std::vector<int> solv125()':
vision.cpp:37:1: warning: no return statement in function returning non-void [-Wreturn-type]
   37 | }
      | ^
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 512 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 512 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 512 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 512 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 3 ms 672 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 384 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 245 ms 1152 KB WA in grader: Too many instructions
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 512 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -