답안 #281557

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
281557 2020-08-23T07:54:05 Z kartel Vision Program (IOI19_vision) C++14
0 / 100
4 ms 1180 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 +200500
#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;

void construct_network(int n, int m, int k)
{
    int kol = 0, i, j, a, b;

    vi vec;

    if (k == 1)
    {
        for (i = 0; i < n ; i += 2)
          for (j = 0; j < m; j += 2)
        {
            vi instr;

            if (i < n - 1 && j < m - 1)
            {
                instr.pb(i * m + j);
                instr.pb(i * m + j + 1);
                instr.pb((i + 1) * m + j);
                instr.pb((i + 1) * m + j + 1);
            }
            else
            {
                instr.pb(i * m + j);
                if (i + 1 < n) instr.pb((i + 1) * m + j);
                if (j + 1 < m) instr.pb(i * m + j + 1);
            }

            add_xor(instr);
            vec.pb(n * m + (kol++));
        }

        add_or(vec);
        add_not(n * m + kol);
        return;
    }

    if ((n > 10 || m > 10) && (n != 1 && m != 1))
    {
        int i = 0;
        while (k >= 0 && i < n)
        {
            vi instr;
            if (k < m)
            {
                instr.pb(0);
                instr.pb(i * m + k);

                add_and(instr);
                vec.pb(n * m + kol);
                kol++;
            }
            i++;
            k--;
        }

        add_or(vec);
        return;
    }
    for (i = 0; i < n; i++)
      for (j = 0; j < m; j++)
        for (a = i; a < n; a++)
          for (b = 0; b < m; b++)
    {
        if (abs(i - a) + abs(j - b) != k)
            continue;

//        cerr << i << " " << j << " " << a << " " << b << el;

        vi instr;
        instr.pb(i * m + j);
        instr.pb(a * m + b);

        add_and(instr);
        vec.pb(n * m + kol);
        kol++;
    }

    add_or(vec);

    return;
}

//int main()
//{
//    srand(time(0));
//    cout.precision(3);
//    cout << fixed;
//    ios_base::sync_with_stdio(0);
//    iostream::sync_with_stdio(0);
//    ios::sync_with_stdio(0);
//    cin.tie(NULL);
//    cout.tie(NULL);
//
////    in("input.txt");
////    out("output.txt");
//
//
//}

/*
4 4
0110
0000
1101
1100
*/
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 256 KB on inputs (0, 1), (0, 2), expected 1, but computed 0
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 256 KB on inputs (0, 1), (0, 2), expected 1, but computed 0
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 256 KB on inputs (0, 1), (0, 2), expected 1, but computed 0
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 256 KB on inputs (0, 1), (0, 2), expected 1, but computed 0
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 256 KB on inputs (0, 1), (0, 2), expected 1, but computed 0
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 256 KB on inputs (0, 0), (1, 1), expected 0, but computed 1
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 4 ms 1180 KB WA in grader: Too many instructions
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 256 KB on inputs (0, 1), (0, 2), expected 1, but computed 0
2 Halted 0 ms 0 KB -