답안 #152110

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
152110 2019-09-06T14:11:17 Z stefdasca Vision Program (IOI19_vision) C++14
컴파일 오류
0 ms 0 KB
#include "vision.h"
#include<bits/stdc++.h>
using namespace std;

void construct_network(int H, int W, int K)
{
    /*
	vector<int> Ns;
	Ns = {0, 1};
	int a = add_and(Ns);
	Ns = {0, a};
	int b = add_or(Ns);
	Ns = {0, 1, b};
	int c = add_xor(Ns);
	add_not(c);
	*/
	int Line1 = -1, Line2 = -1;
	for(int i = 0; i < H; ++i)
    {
        vector<int>v;
        for(int j = 0; j < W; ++j)
            v.pb(i * W + j);
        int ans = add_or(v);
        if(ans == 1)
        {
            if(Line1 != -1)
                Line2 = i;
            else
                Line1 = i;
        }
    }
    if(Line2 == -1)
        Line2 = Line1;
    for(int i = 0; i < W; ++i)
    {
        int ans = add_not(Line1 * W + i);
        if(ans == 0)
        {
            if(Column1 == -1)
                Column1 = i;
            else
                Column2 = i;
        }
    }
    if(Column2 == -1)
        for(int i = 0; i < W; ++i)
        {
            int ans = add_not(Line2 * W + i);
            if(ans == 0)
                Column2 = i;
        }
    add_and({Line1 * W + Column1, Line2 * W + Column2});
}

Compilation message

vision.cpp: In function 'void construct_network(int, int, int)':
vision.cpp:22:15: error: 'class std::vector<int>' has no member named 'pb'
             v.pb(i * W + j);
               ^~
vision.cpp:39:16: error: 'Column1' was not declared in this scope
             if(Column1 == -1)
                ^~~~~~~
vision.cpp:42:17: error: 'Column2' was not declared in this scope
                 Column2 = i;
                 ^~~~~~~
vision.cpp:45:8: error: 'Column2' was not declared in this scope
     if(Column2 == -1)
        ^~~~~~~
vision.cpp:52:26: error: 'Column1' was not declared in this scope
     add_and({Line1 * W + Column1, Line2 * W + Column2});
                          ^~~~~~~
vision.cpp:52:47: error: 'Column2' was not declared in this scope
     add_and({Line1 * W + Column1, Line2 * W + Column2});
                                               ^~~~~~~
vision.cpp:52:55: error: could not convert '{<expression error>, <expression error>}' from '<brace-enclosed initializer list>' to 'std::vector<int>'
     add_and({Line1 * W + Column1, Line2 * W + Column2});
                                                       ^