답안 #761146

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
761146 2023-06-19T09:24:38 Z raysh07 Vision Program (IOI19_vision) C++17
컴파일 오류
0 ms 0 KB
#include "vision.h"
#include <bits/stdc++.h>
using namespace std;

int cell(int i, int j, int m){
    return i * m + j;
}

void construct_network(int n, int m, int k) {
// 	std::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);

    vector <int> r, r2;
    vector <int> a;
    for (int i = 0; i < n; i++){
        a.clear();
        for (int j = 0; j < m; j++) a.push_back(cell(i, j));
        
        int x = add_xor(a);
        r.push_back(x);
        if (i != n - 1){
            a.clear();
            for (int j = 0; j < m; j++) {
                a.push_back(cell(i, j));
                a.push_back(cell(i + 1, j));
            }
            
            x = add_xor(a);
            r2.push_back(x);
        }
    }
    
    vector <int> c, c2;
    for (int j = 0; j < m; j++){
        a.clear();
        for (int i = 0; i < n; i++) a.push_back(cell(i, j));
        
        int x = add_xor(a);
        c.push_back(x);
        
        if (j != m - 1){
            a.clear();
            for (int i = 0; i < n; i++){
                a.push_back(cell(i, j));
                a.push_back(cell(i, j + 1));
            }
            
            x = add_xor(a);
            c2.push_back(x);
        }
    }
    
    int x;
    a.clear();
    for (auto &x : r){
        a.push_back(x);
        x = add_xor(a);
    }
    
    a.clear();
    for (auto &x : r2){
        a.push_back(x);
        x = add_xor(a);
    }
    
    a.clear();
    for (auto &x : c){
        a.push_back(x);
        x = add_xor(a);
    }
    
    a.clear();
    for (auto &x : c2){
        a.push_back(x);
        x = add_xor(a);
    }
    
    int v[4];
    v[0] = add_or(r);
    v[1] = add_or(r2);
    v[2] = add_or(c);
    v[3] = add_or(c2);
    
    vector <int> pos;
    for (int i = 0; i < 4; i++){
        for (int j = i + 1; j < 4; j++){
            x = add_and({v[i], v[j]});
            pos.push_back(x);
        }
    }
    
    add_or(pos);
}

Compilation message

vision.cpp: In function 'void construct_network(int, int, int)':
vision.cpp:23:58: error: too few arguments to function 'int cell(int, int, int)'
   23 |         for (int j = 0; j < m; j++) a.push_back(cell(i, j));
      |                                                          ^
vision.cpp:5:5: note: declared here
    5 | int cell(int i, int j, int m){
      |     ^~~~
vision.cpp:30:38: error: too few arguments to function 'int cell(int, int, int)'
   30 |                 a.push_back(cell(i, j));
      |                                      ^
vision.cpp:5:5: note: declared here
    5 | int cell(int i, int j, int m){
      |     ^~~~
vision.cpp:31:42: error: too few arguments to function 'int cell(int, int, int)'
   31 |                 a.push_back(cell(i + 1, j));
      |                                          ^
vision.cpp:5:5: note: declared here
    5 | int cell(int i, int j, int m){
      |     ^~~~
vision.cpp:42:58: error: too few arguments to function 'int cell(int, int, int)'
   42 |         for (int i = 0; i < n; i++) a.push_back(cell(i, j));
      |                                                          ^
vision.cpp:5:5: note: declared here
    5 | int cell(int i, int j, int m){
      |     ^~~~
vision.cpp:50:38: error: too few arguments to function 'int cell(int, int, int)'
   50 |                 a.push_back(cell(i, j));
      |                                      ^
vision.cpp:5:5: note: declared here
    5 | int cell(int i, int j, int m){
      |     ^~~~
vision.cpp:51:42: error: too few arguments to function 'int cell(int, int, int)'
   51 |                 a.push_back(cell(i, j + 1));
      |                                          ^
vision.cpp:5:5: note: declared here
    5 | int cell(int i, int j, int m){
      |     ^~~~