Submission #422818

# Submission time Handle Problem Language Result Execution time Memory
422818 2021-06-10T12:45:57 Z SSRS Vision Program (IOI19_vision) C++14
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
#include "vision.h"
using namespace std;
void construct_network(int H, int W, int K){
  assert(K == 1);
  int mx = H + W - 1;
  vector<vector<int>> id1(mx), id2(mx);
  for (int i = 0; i < H; i++){
    for (int j = 0; j < W; j++){
      id1[i + j].push_back(i * W + j);
      id2[i - j + (W - 1)].push_back(i * W + j);
    }
  }
  vector<int> a(mx), b(mx);
  for (int i = 0; i < mx; i++){
    a[i] = add_or(id1[i]);
    b[i] = add_or(id2[i]);
  }
  vector<int> a2(mx - 1), b2(mx - 1);
  for (int i = 0; i < mx - 1; i++){
    a2[i] = add_and(a[i], a[i + 1]);
    b2[i] = add_and(b[i], b[i + 1]);
  }
  int X = add_or(a2);
  int Y = add_or(b2);
  add_and(X, Y);
}

Compilation message

vision.cpp: In function 'void construct_network(int, int, int)':
vision.cpp:21:35: error: could not convert 'a.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>'
   21 |     a2[i] = add_and(a[i], a[i + 1]);
      |                                   ^
      |                                   |
      |                                   __gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type {aka int}
vision.cpp:22:35: error: could not convert 'b.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>'
   22 |     b2[i] = add_and(b[i], b[i + 1]);
      |                                   ^
      |                                   |
      |                                   __gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type {aka int}
vision.cpp:26:11: error: could not convert 'X' from 'int' to 'std::vector<int>'
   26 |   add_and(X, Y);
      |           ^
      |           |
      |           int