답안 #620892

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
620892 2022-08-03T10:07:24 Z beaconmc Vision Program (IOI19_vision) C++14
26 / 100
204 ms 6612 KB
#include "vision.h"

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

typedef int ll;
using namespace std;
using namespace __gnu_pbds;

#define FOR(i, x, y) for(ll i=x; i<y; i++)
#define FORNEG(i, x, y) for(ll i=x; i>y; i--)
#define ordered_set tree<ll, null_type,less_equal<ll>, rb_tree_tag,tree_order_statistics_node_update>
#define fast() ios_base::sync_with_stdio(false);cin.tie(NULL)
ll h,w,k;

vector<int> hashh(vector<int> a){
	return {a[0]+a[1], a[1]-a[0]};
}

int unhashh(vector<int> a){
	vector<int> temp =  {(a[0]-a[1])/2, (a[0]+a[1])/2};


	return w*temp[0]+temp[1];
}


void construct_network(int H, int W, int K) {
	h=H; w=W; k=K;

	set<ll> x;
	set<ll> y;


	vector<vector<ll>> stuff;
	FOR(i,0,h){
		FOR(j,0,w){
			stuff.push_back(hashh({i,j}));
		}
	}

	for (auto&i : stuff){
		x.insert(i[0]);
		y.insert(i[1]);
	}
	vector<int> fx, fy, sx, sy;

	for (auto&i : x){
		vector<int> fir,sec;
		for (auto&j : stuff){
			if (j[0] == i) fir.push_back(unhashh(j));
			else if (j[0] == i-k || j[0] == i+k) sec.push_back(unhashh(j));
		}
		if (!(fir.size() && sec.size())){
			fx.push_back(add_xor({0,0}));
			fx.push_back(add_xor({0,0}));
			continue;
		}

		fx.push_back(add_xor(fir));
		fx.push_back(add_xor(sec));
	}
	for (auto&i : y){
		vector<int> fir,sec;
		for (auto&j : stuff){
			if (j[1] == i) fir.push_back(unhashh(j));
			else if (j[1] >= i-k && j[1] <= i+k) sec.push_back(unhashh(j));
		}
		if (!(fir.size() && sec.size())){
			fy.push_back(add_xor({0,0}));
			fy.push_back(add_xor({0,0}));
			continue;
		}

		fy.push_back(add_xor(fir));
		fy.push_back(add_xor(sec));
	}

	for (auto&i : y){
		vector<int> fir,sec;
		for (auto&j : stuff){
			if (j[1] == i) fir.push_back(unhashh(j));
			else if (j[1] == i-k || j[1] == i+k) sec.push_back(unhashh(j));
		}
		if (!(fir.size() && sec.size())){
			sy.push_back(add_xor({0,0}));
			sy.push_back(add_xor({0,0}));
			continue;
		}
		sy.push_back(add_xor(fir));
		sy.push_back(add_xor(sec));
	}

	for (auto&i : x){
		vector<int> fir,sec;
		for (auto&j : stuff){
			if (j[0] == i) fir.push_back(unhashh(j));
			else if (j[0] >= i-k && j[0] <= i+k) sec.push_back(unhashh(j));
		}
		if (!(fir.size() && sec.size())){
			sx.push_back(add_xor({0,0}));
			sx.push_back(add_xor({0,0}));
			continue;
		}
		sx.push_back(add_xor(fir));
		sx.push_back(add_xor(sec));
	}


	vector<int> ffx, ffy, ssx, ssy;
	while (fx.size()){
		ll temp1,temp2;
		temp1 = fx[fx.size()-1];
		temp2 = fx[fx.size()-2];
		ffx.push_back(add_and({temp1, temp2}));
		fx.pop_back();
		fx.pop_back();
	}
	while (fy.size()){
		ll temp1,temp2;
		temp1 = fy[fy.size()-1];
		temp2 = fy[fy.size()-2];
		ffy.push_back(add_and({temp1, temp2}));
		fy.pop_back();
		fy.pop_back();
	}
	while (sx.size()){
		ll temp1,temp2;
		temp1 = sx[sx.size()-1];
		temp2 = sx[sx.size()-2];
		ssx.push_back(add_and({temp1, temp2}));
		sx.pop_back();
		sx.pop_back();
	}
	while (sy.size()){
		ll temp1,temp2;
		temp1 = sy[sy.size()-1];
		temp2 = sy[sy.size()-2];
		ssy.push_back(add_and({temp1, temp2}));
		sy.pop_back();
		sy.pop_back();
	}

	ll a,b,c,d;
	a = add_or(ffx);
	b = add_or(ffy);
	c = add_or(ssx);
	d = add_or(ssy);

	ll aa = add_and({a,b});
	ll bb = add_and({c,d});
	add_or({aa,bb});

}


# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 296 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Incorrect 1 ms 212 KB on inputs (0, 1), (1, 0), expected 1, but computed 0
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 296 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Incorrect 1 ms 212 KB on inputs (0, 1), (1, 0), expected 1, but computed 0
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 296 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Incorrect 1 ms 212 KB on inputs (0, 1), (1, 0), expected 1, but computed 0
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 296 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Incorrect 1 ms 212 KB on inputs (0, 1), (1, 0), expected 1, but computed 0
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 468 KB Output is correct
2 Correct 14 ms 980 KB Output is correct
3 Correct 15 ms 1024 KB Output is correct
4 Correct 13 ms 1108 KB Output is correct
5 Correct 3 ms 468 KB Output is correct
6 Correct 9 ms 828 KB Output is correct
7 Correct 10 ms 984 KB Output is correct
8 Correct 18 ms 1100 KB Output is correct
9 Correct 2 ms 468 KB Output is correct
10 Correct 10 ms 812 KB Output is correct
11 Correct 10 ms 992 KB Output is correct
12 Correct 14 ms 936 KB Output is correct
13 Correct 15 ms 1076 KB Output is correct
14 Correct 21 ms 1068 KB Output is correct
15 Correct 2 ms 556 KB Output is correct
16 Correct 8 ms 724 KB Output is correct
17 Correct 11 ms 972 KB Output is correct
18 Correct 9 ms 936 KB Output is correct
19 Correct 12 ms 1140 KB Output is correct
20 Correct 13 ms 1060 KB Output is correct
21 Correct 1 ms 212 KB Output is correct
22 Correct 1 ms 296 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Incorrect 0 ms 212 KB on inputs (0, 0), (1, 1), expected 1, but computed 0
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 204 ms 6612 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 13 ms 852 KB Output is correct
4 Correct 28 ms 1308 KB Output is correct
5 Correct 3 ms 552 KB Output is correct
6 Correct 3 ms 468 KB Output is correct
7 Correct 97 ms 3508 KB Output is correct
8 Correct 106 ms 3408 KB Output is correct
9 Correct 174 ms 6560 KB Output is correct
10 Correct 1 ms 296 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 296 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Incorrect 1 ms 212 KB on inputs (0, 1), (1, 0), expected 1, but computed 0
7 Halted 0 ms 0 KB -