Submission #955298

# Submission time Handle Problem Language Result Execution time Memory
955298 2024-03-30T05:37:40 Z 8pete8 Vision Program (IOI19_vision) C++17
Compilation error
0 ms 0 KB
#include "vision.h"
#include<iostream>
#include<stack>
#include<map>
#include<vector>
#include<string>
#include<unordered_map>
#include <queue>
#include<cstring>
#include<limits.h>
#include <cassert>
#include<cmath>
#include<set>
#include<algorithm>
#include <iomanip>
#include<numeric> //gcd(a,b)
#include<bitset>
using namespace std;
#define ll long long
#define f first
#define endl "\n"
#define s second
#define pii pair<int,int>
#define ppii pair<int,pii>
#define vi vector<int>
#define pb push_back
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define F(n) for(int i=0;i<n;i++)
#define lb lower_bound
#define ub upper_bound
#define fastio ios::sync_with_stdio(false);cin.tie(NULL);
#pragma GCC optimize ("03,unroll-loops")
using namespace std;
int cnt=0;
/*
int add_or(vector<int>v){
	cnt++;
	return 0;
}
int add_and(vector<int>v){
	cnt++;
	return 0;
}
int add_xor(vector<int>v){
	cnt++;
	return 0;
}*/
void construct_network(int h, int w, int k){
	vector<int>ans;
	auto valid=[&](int a,int b){
		if(a<0||b<0||a>=h||b>=w)return false;
		return true;
	};
	auto get=[&](int a,int b){return a*w+b;};
	auto dist=[&](int a,int b,int x,int y){return abs(a-x)+abs(b-y);};
	vector<vector<bool>>done(h+1,vector<bool>(w+1,0));
	auto getdiag=[&](int a,int b,int x,int y,vector<int>&v,int mode){
		while(dist(a,b,x,y)==k){
			if(valid(a,b))v.pb(get(a,b));
			if(mode)a--,b--;
			else a++,b--;
		}
	};
	if(k==1){
		vector<int>idrow(h),idcol(w);
		vector<int>row2(h),col2(w);
		for(int i=0;i<h;i++){
			vector<int>v;
			for(int j=0;j<w;j++)v.pb(get(i,j));
			idrow[i]=add_or(v);
		}
		for(int j=0;j<w;j++){
			vector<int>v;
			for(int i=0;i<h;i++)v.pb(get(i,j));
			idcol[j]=add_or(v);
		}
		for(int i=1;i<w;i++)col2[i]=add_or({idcol[i],idcol[i-1]});
		for(int i=1;i<h;i++)row2[i]=add_or({idrow[i],idrow[i-1]});
		vector<int>ans;
		for(int k=0;k<2;k++){
			vector<int>v,v2;
			for(int i=1;i<col2.size();i+=2)v.pb(col2[i]);
			for(auto i:idrow)v2.pb(i);
			int x=add_xor(v2);
			if(v.size()){
				int y=add_xor(v);
				ans.pb(add_and({x,y}));
			}
			v.clear();
			for(int i=2;i<col2.size();i+=2)v.pb(col2[i]);
			if(v.size()){
				y=add_xor(v);
				ans.pb(add_and({x,y}));
			}
			swap(col2,row2);
			swap(idrow,idcol);
		}
		add_or(ans);
		return;
	}
	for(int i=0;i<h;i++)for(int j=0;j<w;j++){
		vector<int>v;
		if(h>30&&w>30){
			getdiag(i,j+k,i,j,v,1);
			getdiag(i,j+k,i,j,v,0);
			if(v.size()){
				int x=add_or(v);
				x=add_and({get(i,j),x});
			}
			return;
		}
		getdiag(i,j+k,i,j,v,1);
		getdiag(i,j+k,i,j,v,0);
		getdiag(i+k,j,i,j,v,1);
		getdiag(i-k,j,i,j,v,0);
		if(!v.empty()){
			int x=add_or(v);
			ans.pb(add_and({get(i,j),x}));
		}
	}
	add_or(ans);
	return;
}/*
int32_t main(){
	int a,b,k;cin>>a>>b>>k;
	construct_network(a,b,k);
	cout<<cnt<<'\n';
}*/

Compilation message

vision.cpp: In function 'void construct_network(int, int, int)':
vision.cpp:83:17: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   83 |    for(int i=1;i<col2.size();i+=2)v.pb(col2[i]);
      |                ~^~~~~~~~~~~~
vision.cpp:91:17: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   91 |    for(int i=2;i<col2.size();i+=2)v.pb(col2[i]);
      |                ~^~~~~~~~~~~~
vision.cpp:93:5: error: 'y' was not declared in this scope
   93 |     y=add_xor(v);
      |     ^
vision.cpp:94:25: error: could not convert '{x, y}' from '<brace-enclosed initializer list>' to 'std::vector<int>'
   94 |     ans.pb(add_and({x,y}));
      |                         ^
      |                         |
      |                         <brace-enclosed initializer list>