답안 #167729

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
167729 2019-12-09T20:33:21 Z davitmarg Vision Program (IOI19_vision) C++17
14 / 100
11 ms 1400 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;
        x.PB(hor[i]);
        x.PB(hor[i + 1]);
        x.PB(allv);

        add_and(x);
        id++;

        x.clear();
        x.PB(id - 1);
        if (last != -1)
            x.PB(last);
        add_or(x);
        last = id++;
    }

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

        add_and(x);
        id++;

        x.clear();
        x.PB(id - 1);
        if (last != -1)
            x.PB(last);
        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 Correct 2 ms 376 KB Output is correct
2 Incorrect 2 ms 376 KB on inputs (0, 0), (0, 1), expected 0, but computed 1
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Incorrect 2 ms 376 KB on inputs (0, 0), (0, 1), expected 0, but computed 1
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Incorrect 2 ms 376 KB on inputs (0, 0), (0, 1), expected 0, but computed 1
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Incorrect 2 ms 376 KB on inputs (0, 0), (0, 1), expected 0, but computed 1
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Incorrect 2 ms 376 KB on inputs (0, 0), (0, 1), expected 0, but computed 1
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Incorrect 2 ms 376 KB on inputs (0, 0), (0, 1), expected 0, but computed 1
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 11 ms 1400 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Correct 3 ms 376 KB Output is correct
4 Correct 3 ms 504 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
7 Correct 7 ms 760 KB Output is correct
8 Correct 7 ms 736 KB Output is correct
9 Correct 11 ms 1192 KB Output is correct
10 Correct 2 ms 376 KB Output is correct
11 Correct 2 ms 376 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Incorrect 2 ms 376 KB on inputs (0, 0), (0, 1), expected 0, but computed 1
3 Halted 0 ms 0 KB -