답안 #425747

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
425747 2021-06-13T10:53:43 Z alishahali1382 Vision Program (IOI19_vision) C++17
컴파일 오류
0 ms 0 KB
#include "vision.h"
#include<bits/stdc++.h>
#pragma GCC optimize("O2")
using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
#define debug(x) {cerr<<#x<<"="<<x<<"\n";}
#define debug2(x, y) {cerr<<"{"<<#x<<", "<<#y<<"}={"<<x<<", "<<y<<"}\n";}
#define debugp(p) {cerr<<#p<<"={"<<p.first<<", "<<p.second<<"}\n";}
#define debugv(abcd) {cerr<<#abcd<<": ";for (auto dcba:abcd) cerr<<dcba<<", ";cerr<<"\n";}
#define pb push_back
#define SZ(x) ((int)x.size())
#define all(x) x.begin(), x.end()

const int inf=1000001000; // 1e9
const ll INF=10000000010000000; // 1e16
const int mod=1000000007;
const int MAXN=100010;

int n, m, k;

inline int get_id(int x, int y){ return x*m+y;}

void construct_network(int _n, int _m, int _k){
	n=_n;
	m=_m;
	k=_k;
	
	vi X, Y;
	for (int i=0; i<n; i++){
		vi shit(m);
		for (int j=0; j<m; j++) shit[j]=get_id(i, j);
		X.pb(add_or(shit));
	}
	for (int j=0; j<m; j++){
		vi shit(n);
		for (int i=0; i<m; i++) shit[i]=get_id(i, j);
		Y.pb(add_or(shit));
	}
	
	vi DX(n, 0), DY(n, 0);
	for (int d=n-1; ~d; d--){
		vi shit;
		for (int i=0; i+d<n; i++){
			shit.pb(add_and(X[i], X[i+d]));
		}
		if (d<n-1) shit.pb(DX[d+1]);
		DX[d]=add_or(shit);
	}
	for (int d=m-1; ~d; d--){
		vi shit;
		for (int i=0; i+d<m; i++){
			shit.pb(add_and(Y[i], Y[i+d]));
		}
		if (d<m-1) shit.pb(DY[d+1]);
		DY[d]=add_or(shit);
	}
	// optimize for d=0 case

	vi A, B;
	for (int i=0; i<n; i++) for (int j=0; j<n; j++){
		if (i+j==k) A.pb(add_and(DX[i], DY[j]));
		if (i+j==k+1) B.pb(add_and(DX[i], DY[j]));
	}
	int a=add_or(A);
	int b=add_or(B);
	add_and(a, add_not(b));
}

Compilation message

vision.cpp: In function 'void construct_network(int, int, int)':
vision.cpp:48:32: error: could not convert 'X.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>'
   48 |    shit.pb(add_and(X[i], X[i+d]));
      |                                ^
      |                                |
      |                                __gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type {aka int}
vision.cpp:56:32: error: could not convert 'Y.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>'
   56 |    shit.pb(add_and(Y[i], Y[i+d]));
      |                                ^
      |                                |
      |                                __gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type {aka int}
vision.cpp:65:40: error: could not convert 'DX.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>'
   65 |   if (i+j==k) A.pb(add_and(DX[i], DY[j]));
      |                                        ^
      |                                        |
      |                                        __gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type {aka int}
vision.cpp:66:42: error: could not convert 'DX.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>'
   66 |   if (i+j==k+1) B.pb(add_and(DX[i], DY[j]));
      |                                          ^
      |                                          |
      |                                          __gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type {aka int}
vision.cpp:70:10: error: could not convert 'a' from 'int' to 'std::vector<int>'
   70 |  add_and(a, add_not(b));
      |          ^
      |          |
      |          int