답안 #414598

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
414598 2021-05-30T17:50:29 Z ollel Vision Program (IOI19_vision) C++14
컴파일 오류
0 ms 0 KB
#include <bits/stdc++.h>
#include <iostream>
#include "vision.h"
using namespace std;

#define rep(i,a,b) for(int i = a; i < b; i++)
#define pb push_back

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> pii;

int h, w, k, inst;

// bool add_or(vi& q) {
//   cout << "or:\n";
//   for(auto &i : q) cout << i << " ";cout<<endl;
//   bool ans; cin >> ans;
//   return ans;
// }
//
// bool add_not(int x ) {
//   cout << "not:\n";
//   cout << x << endl;
//   bool ans; cin >> ans; return ans;
// }
//
// bool add_and(vi& q) {
//   cout << "and:\n";
//   for(auto &i : q) cout << i << " ";cout<<endl;
//   bool ans; cin >> ans;
//   return ans;
// }


kone()
{
  vi rows;
  rep(i, 0, h) {
    vi indices;
    rep(j, 0, w) indices.pb(j + i*w);
    rows.pb(add_or(indices));
  }

  vi cols;
  rep(j, 0, w) {
    vi indices;
    rep(i, 0, h) indices.pb(j + i*w);
    cols.pb(add_or(indices));
  }

  vi adjc;
  rep(i, 0, w - 1) {
    adjc.pb(add_and(cols[i], cols[i + 1]));
  }
  vi adjr;
  rep(i, 0, h - 1) {
    adjr.pb(add_and(rows[i], rows[i + 1]));
  }

  vi pos;
  pos.pb(add_and(add_xor(rows), add_or(adjc)));
  pos.pb(add_and(add_xor(cols), add_or(adjr)));

  add_or(pos);
}

void construct_network(int H, int W, int K)
{
  h = H; w = W; k = K; inst = h * w;
  if (k == 1) kone();

  int fi = inst;
  rep(x, 0, w) rep(y, 0, h) {
    vi ask = {x+y*w};
    rep(x2, 0, w) rep(y2, 0, h) {
      if (abs(x2 - x) + abs(y2 - y) == k) {
        vi ask = {x+y*w, x2+y2*w};
        inst = add_and(ask);
      }
    }
  }

  vi ask;
  rep(i,fi,inst+1) ask.pb(i);
  add_or(ask);
}

// int main() {
//   int H ,W, K; cin >> H>>W>>K;construct_network(H, W, K);
// }

Compilation message

vision.cpp:37:1: error: ISO C++ forbids declaration of 'kone' with no type [-fpermissive]
   37 | kone()
      | ^~~~
vision.cpp: In function 'int kone()':
vision.cpp:55:41: error: could not convert 'cols.std::vector<int>::operator[](((std::vector<int>::size_type)i))' from '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'} to 'std::vector<int>'
   55 |     adjc.pb(add_and(cols[i], cols[i + 1]));
      |                                         ^
      |                                         |
      |                                         __gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type {aka int}
vision.cpp:59:41: error: could not convert 'rows.std::vector<int>::operator[](((std::vector<int>::size_type)i))' from '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'} to 'std::vector<int>'
   59 |     adjr.pb(add_and(rows[i], rows[i + 1]));
      |                                         ^
      |                                         |
      |                                         __gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type {aka int}
vision.cpp:63:25: error: could not convert 'add_xor(std::vector<int>(rows))' from 'int' to 'std::vector<int>'
   63 |   pos.pb(add_and(add_xor(rows), add_or(adjc)));
      |                  ~~~~~~~^~~~~~
      |                         |
      |                         int
vision.cpp:64:25: error: could not convert 'add_xor(std::vector<int>(cols))' from 'int' to 'std::vector<int>'
   64 |   pos.pb(add_and(add_xor(cols), add_or(adjr)));
      |                  ~~~~~~~^~~~~~
      |                         |
      |                         int
vision.cpp:67:1: warning: no return statement in function returning non-void [-Wreturn-type]
   67 | }
      | ^