답안 #167728

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
167728 2019-12-09T20:25:26 Z davitmarg Vision Program (IOI19_vision) C++17
0 / 100
10 ms 1144 KB
/*DavitMarg*/
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <string>
#include <cstring>
#include <map>
#include <unordered_map>
#include <set>
#include <queue>
#include <iomanip>
#include <bitset>
#include <stack>
#include <cassert>
#include <iterator>
#include <fstream>
#define mod 998244353ll
#define LL long long
#define LD long double
#define MP make_pair
#define PB push_back
#define all(v) v.begin(), v.end()
using namespace std;

#ifndef death
#include "vision.h"
#endif

#ifdef death

int add_not(int x)
{
    cout << "add_not " << x << endl;
}

int add_and(vector<int> a)
{
    cout << "add_and ";
    for (int i = 0; i < a.size(); i++)
        cout << a[i] << " ";
    cout << endl;
}

int add_or(vector<int> a)
{
    cout << "add_or ";
    for (int i = 0; i < a.size(); i++)
        cout << a[i] << " ";
    cout << endl;
}

int add_xor(vector<int> a)
{
    cout << "add_xor ";
    for (int i = 0; i < a.size(); i++)
        cout << a[i] << " ";
    cout << endl;
}

#endif

int n, m, k, id, allh, allv;
int last = -1;

int ind(int y, int x)
{
    return y * m + x;
}

vector<pair<int, int>> p;

void construct_network(int H, int W, int K)
{
    n = H;
    m = W;
    k = K;
    vector<int> hor(n + 5), ver(m + 5);
    id = n * m;
    for (int i = 0; i < n; i++)
    {
        vector<int> x;
        for (int j = 0; j < m; j++)
            x.PB(ind(i, j));
        add_xor(x);
        hor[i] = id++;
    }

    for (int j = 0; j < m; j++)
    {
        vector<int> x;
        for (int i = 0; i < n; i++)
            x.PB(ind(i, j));
        add_xor(x);
        ver[j] = id++;
    }

    vector<int> a;

    a.clear();
    for (int i = 0; i < n; i++)
        a.PB(hor[i]);

    add_or(a);
    id++;
    add_not(id - 1);
    allh = id++;

    a.clear();
    for (int i = 0; i < m; i++)
        a.PB(ver[i]);

    add_or(a);
    id++;
    add_not(id - 1);
    allv = id++;

    for (int i = 0; i < n - 1; i++)
    {
        vector<int> x;
        if (last != -1)
            x.PB(last);
        x.PB(hor[i]);
        x.PB(hor[i + 1]);
        x.PB(allv);

        add_or(x);
        last = id++;
    }

    for (int i = 0; i < m - 1; i++)
    {
        vector<int> x;
        if (last != -1)
            x.PB(last);
        x.PB(ver[i]);
        x.PB(ver[i + 1]);
        x.PB(allh);

        add_or(x);
        last = id++;
    }
}

#ifdef death

int main()
{
    int N, M, K;
    cin >> N >> M >> K;
    construct_network(N, M, K);
    return 0;
}

#endif

/*


 
 
*/
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 256 KB on inputs (0, 0), (0, 2), expected 0, but computed 1
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 256 KB on inputs (0, 0), (0, 2), expected 0, but computed 1
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 256 KB on inputs (0, 0), (0, 2), expected 0, but computed 1
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 256 KB on inputs (0, 0), (0, 2), expected 0, but computed 1
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 376 KB on inputs (0, 0), (0, 2), expected 0, but computed 1
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 256 KB on inputs (0, 0), (1, 1), expected 0, but computed 1
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 10 ms 1144 KB on inputs (126, 120), (176, 169), expected 0, but computed 1
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 256 KB on inputs (0, 0), (0, 2), expected 0, but computed 1
2 Halted 0 ms 0 KB -