Submission #165968

# Submission time Handle Problem Language Result Execution time Memory
165968 2019-11-29T22:40:51 Z nickmet2004 Vision Program (IOI19_vision) C++14
Compilation error
0 ms 0 KB
#include<bits/stdc++.h>
#include "vision.h"

using namespace std;
 
int solve(int h , int m, int K){
 
    vector<int> Dl[40050] , Dr[40050];
    for(int i = 0; i < h; ++i){
        for(int j = 0; j < w; ++j){
            // emplace back the elements on diagonals , position off memory array
            Dl[i - j].push_back(i * w + j);
            Dr[i + j + w - 1].push_back(i * w + j);
        }
    }
    
	vector<int> DiagLor , DiagRor , ans;
 
	for(int i = 0; i <= h + w - 2; i++){
		DiagLor.push_back(add_or(Dl[i]));
		DiagRor.push_back(add_or(Dr[i]));
		if(i >= K){
			ans.push_back( add_and( { DiagLor[i] , DiagLor[i - K] } ) );
			ans.push_back( add_and( { DiagRor[i] , DiagRor[i - K] } ) );
		}
	}
	return add_or(ans);
}
 
void construct_network(int H , int W , int K) {
	if(H + W - 2 == K){
        solve(H , W , K);
	}
	else {
        add_xor( {solve(H , W , K), solve(H , W , K + 1) } );
	}
}

Compilation message

vision.cpp: In function 'int solve(int, int, int)':
vision.cpp:10:28: error: 'w' was not declared in this scope
         for(int j = 0; j < w; ++j){
                            ^
vision.cpp:19:26: error: 'w' was not declared in this scope
  for(int i = 0; i <= h + w - 2; i++){
                          ^