답안 #291355

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
291355 2020-09-05T07:47:39 Z mohammad Vision Program (IOI19_vision) C++14
33 / 100
65 ms 21868 KB
#include "vision.h"
#include<bits/stdc++.h>
using namespace std;
 
#define endl "\n"
// #define int long long

typedef long long ll ;
const ll ooo = 1e14 ;
const ll oo = 2e9 ;
const double PI = acos(-1) ;
const ll M = 1e9 + 7  ;
const int N = 10000010  ;

map<pair<int , int> , int > mp , use;
vector<pair<int,int>> v[410] ;
int d[222][222] , ask[222][222];

void construct_network(int H, int W, int K) {
	vector<int> Ns , f;
	for(int i = 0 ; i < H ; ++i){
		for(int j = 0 ; j < W ; ++j){
			for(int l = 0 ; l <= K ; l++){
				int u = K - l ;
				int nx = i + l , ny = j + u ;
				int vl = i * W + j , vl1 = nx * W + ny;
				if(min(nx , ny) >= 0 && nx < H && ny < W && !mp[{vl , vl1}]){
					mp[{vl , vl1}] = 1;
					mp[{vl1 , vl}] = 1;
					d[nx][ny]++;
					d[i][j]++;
				}
				nx = i - l , ny = j + u;
				vl1 = nx * W + ny;
				if(min(nx , ny) >= 0 && nx < H && ny < W && !mp[{vl , vl1}]){
					mp[{vl , vl1}] = 1;
					mp[{vl1 , vl}] = 1;
					d[nx][ny]++;
					d[i][j]++;
				}
				nx = i - l , ny = j - u;
				vl1 = nx * W + ny;
				if(min(nx , ny) >= 0 && nx < H && ny < W && !mp[{vl , vl1}]){
					mp[{vl , vl1}] = 1;
					mp[{vl1 , vl}] = 1;
					d[nx][ny]++;
					d[i][j]++;
				}
				nx = i + l , ny = j - u;
				vl1 = nx * W + ny;
				if(min(nx , ny) >= 0 && nx < H && ny < W && !mp[{vl , vl1}]){
					mp[{vl , vl1}] = 1;
					mp[{vl1 , vl}] = 1;
					d[nx][ny]++;
					d[i][j]++;
				}
			}
		}
	}
	for(int i = 0 ; i < H ; ++i)
		for(int j = 0 ; j < W ; ++j){
			v[d[i][j]].push_back({i , j});
		}
	for(int k = 400 ; k ; --k){
		while(v[k].size()){
			int i = v[k].back().first , j = v[k].back().second;
			v[k].erase(v[k].begin() + v[k].size() - 1);
			if(d[i][j] != k) continue ;
			int vl = i * W + j;
			Ns.clear();
			for(int l = 0 ; l <= K ; l++){
				int u = K - l ;
				int nx = i + l , ny = j + u ;
				int vl1 = nx * W + ny;
				if(min(nx , ny) >= 0 && nx < H && ny < W && !ask[vl][vl1]){
					ask[vl][vl1] = 1;
					ask[vl1][vl] = 1;
					if(d[i][j] <= 2){
						Ns = {vl , vl1};
						//cout << Ns[0] << ' ' << Ns[1] << endl;
						int a = add_and(Ns);
						f.push_back(a);
					}else{
						d[nx][ny]--;
						v[d[nx][ny]].push_back({nx , ny});
						Ns.push_back(vl1);
					}
				}
				nx = i - l , ny = j + u;
				vl1 = nx * W + ny;
				if(min(nx , ny) >= 0 && nx < H && ny < W && !ask[vl][vl1]){
					ask[vl][vl1] = 1;
					ask[vl1][vl] = 1;
					if(d[i][j] <= 2){
						Ns = {vl , vl1};
						//cout << Ns[0] << ' ' << Ns[1] << endl;
						int a = add_and(Ns);
						f.push_back(a);
					}else{
						d[nx][ny]--;
						v[d[nx][ny]].push_back({nx , ny});
						Ns.push_back(vl1);
					}
				}
				nx = i - l , ny = j - u;
				vl1 = nx * W + ny;
				if(min(nx , ny) >= 0 && nx < H && ny < W && !ask[vl][vl1]){
					ask[vl][vl1] = 1;
					ask[vl1][vl] = 1;
					if(d[i][j] <= 2){
						Ns = {vl , vl1};
						//cout << Ns[0] << ' ' << Ns[1] << endl;
						int a = add_and(Ns);
						f.push_back(a);
					}else{
						d[nx][ny]--;
						v[d[nx][ny]].push_back({nx , ny});
						Ns.push_back(vl1);
					}
				}
				nx = i + l , ny = j - u;
				vl1 = nx * W + ny;
				if(min(nx , ny) >= 0 && nx < H && ny < W && !ask[vl][vl1]){
					ask[vl][vl1] = 1;
					ask[vl1][vl] = 1;
					if(d[i][j] <= 2){
						Ns = {vl , vl1};
						//cout << Ns[0] << ' ' << Ns[1] << endl;
						int a = add_and(Ns);
						f.push_back(a);
					}else{
						d[nx][ny]--;
						v[d[nx][ny]].push_back({nx , ny});
						Ns.push_back(vl1);
					}
				}
			}
			if(d[i][j] > 2){
				//cout << Ns.size() << endl;
				int a = add_or(Ns);
				Ns = {vl , a};
				a = add_and(Ns);
				f.push_back(a);
			}
			d[i][j] = 0;
		}
	}
	//cout << f.size() << endl;
	add_or(f);
	return ;
}

// freopen("C:\\Users\\mhmdsa\\Documents\\c++\\input.txt" , "r" , stdin );
// freopen("C:\\Users\\mhmdsa\\Documents\\c++\\output.txt" , "w" , stdout );
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 384 KB Output is correct
2 Correct 1 ms 384 KB Output is correct
3 Correct 1 ms 384 KB Output is correct
4 Correct 1 ms 384 KB Output is correct
5 Correct 0 ms 384 KB Output is correct
6 Correct 1 ms 384 KB Output is correct
7 Correct 0 ms 384 KB Output is correct
8 Correct 1 ms 384 KB Output is correct
9 Correct 0 ms 384 KB Output is correct
10 Correct 1 ms 384 KB Output is correct
11 Correct 1 ms 384 KB Output is correct
12 Correct 1 ms 384 KB Output is correct
13 Correct 1 ms 384 KB Output is correct
14 Correct 1 ms 384 KB Output is correct
15 Correct 0 ms 384 KB Output is correct
16 Correct 1 ms 384 KB Output is correct
17 Correct 0 ms 384 KB Output is correct
18 Correct 1 ms 384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 384 KB Output is correct
2 Correct 1 ms 384 KB Output is correct
3 Correct 1 ms 384 KB Output is correct
4 Correct 1 ms 384 KB Output is correct
5 Correct 0 ms 384 KB Output is correct
6 Correct 1 ms 384 KB Output is correct
7 Correct 0 ms 384 KB Output is correct
8 Correct 1 ms 384 KB Output is correct
9 Correct 0 ms 384 KB Output is correct
10 Correct 1 ms 384 KB Output is correct
11 Correct 1 ms 384 KB Output is correct
12 Correct 1 ms 384 KB Output is correct
13 Correct 1 ms 384 KB Output is correct
14 Correct 1 ms 384 KB Output is correct
15 Correct 0 ms 384 KB Output is correct
16 Correct 1 ms 384 KB Output is correct
17 Correct 0 ms 384 KB Output is correct
18 Correct 1 ms 384 KB Output is correct
19 Correct 0 ms 384 KB Output is correct
20 Correct 0 ms 384 KB Output is correct
21 Correct 1 ms 384 KB Output is correct
22 Correct 1 ms 384 KB Output is correct
23 Correct 1 ms 512 KB Output is correct
24 Correct 1 ms 512 KB Output is correct
25 Correct 1 ms 512 KB Output is correct
26 Correct 1 ms 384 KB Output is correct
27 Correct 0 ms 384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 384 KB Output is correct
2 Correct 1 ms 384 KB Output is correct
3 Correct 1 ms 384 KB Output is correct
4 Correct 1 ms 384 KB Output is correct
5 Correct 0 ms 384 KB Output is correct
6 Correct 1 ms 384 KB Output is correct
7 Correct 0 ms 384 KB Output is correct
8 Correct 1 ms 384 KB Output is correct
9 Correct 0 ms 384 KB Output is correct
10 Correct 1 ms 384 KB Output is correct
11 Correct 1 ms 384 KB Output is correct
12 Correct 1 ms 384 KB Output is correct
13 Correct 1 ms 384 KB Output is correct
14 Correct 1 ms 384 KB Output is correct
15 Correct 0 ms 384 KB Output is correct
16 Correct 1 ms 384 KB Output is correct
17 Correct 0 ms 384 KB Output is correct
18 Correct 1 ms 384 KB Output is correct
19 Correct 0 ms 384 KB Output is correct
20 Correct 0 ms 384 KB Output is correct
21 Correct 1 ms 384 KB Output is correct
22 Correct 1 ms 384 KB Output is correct
23 Correct 1 ms 512 KB Output is correct
24 Correct 1 ms 512 KB Output is correct
25 Correct 1 ms 512 KB Output is correct
26 Correct 1 ms 384 KB Output is correct
27 Correct 0 ms 384 KB Output is correct
28 Runtime error 13 ms 4224 KB Execution killed with signal 11
29 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 384 KB Output is correct
2 Correct 1 ms 384 KB Output is correct
3 Correct 1 ms 384 KB Output is correct
4 Correct 1 ms 384 KB Output is correct
5 Correct 0 ms 384 KB Output is correct
6 Correct 1 ms 384 KB Output is correct
7 Correct 0 ms 384 KB Output is correct
8 Correct 1 ms 384 KB Output is correct
9 Correct 0 ms 384 KB Output is correct
10 Correct 1 ms 384 KB Output is correct
11 Correct 1 ms 384 KB Output is correct
12 Correct 1 ms 384 KB Output is correct
13 Correct 1 ms 384 KB Output is correct
14 Correct 1 ms 384 KB Output is correct
15 Correct 0 ms 384 KB Output is correct
16 Correct 1 ms 384 KB Output is correct
17 Correct 0 ms 384 KB Output is correct
18 Correct 1 ms 384 KB Output is correct
19 Correct 0 ms 384 KB Output is correct
20 Correct 0 ms 384 KB Output is correct
21 Correct 1 ms 384 KB Output is correct
22 Correct 1 ms 384 KB Output is correct
23 Correct 1 ms 512 KB Output is correct
24 Correct 1 ms 512 KB Output is correct
25 Correct 1 ms 512 KB Output is correct
26 Correct 1 ms 384 KB Output is correct
27 Correct 0 ms 384 KB Output is correct
28 Runtime error 13 ms 4224 KB Execution killed with signal 11
29 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 512 KB Output is correct
2 Correct 1 ms 512 KB Output is correct
3 Correct 1 ms 512 KB Output is correct
4 Correct 1 ms 384 KB Output is correct
5 Correct 1 ms 768 KB Output is correct
6 Correct 1 ms 768 KB Output is correct
7 Correct 1 ms 640 KB Output is correct
8 Correct 1 ms 384 KB Output is correct
9 Correct 1 ms 512 KB Output is correct
10 Correct 1 ms 512 KB Output is correct
11 Correct 1 ms 640 KB Output is correct
12 Correct 1 ms 512 KB Output is correct
13 Correct 1 ms 384 KB Output is correct
14 Correct 1 ms 384 KB Output is correct
15 Correct 1 ms 768 KB Output is correct
16 Correct 1 ms 768 KB Output is correct
17 Correct 1 ms 640 KB Output is correct
18 Correct 1 ms 640 KB Output is correct
19 Correct 1 ms 512 KB Output is correct
20 Correct 1 ms 384 KB Output is correct
21 Correct 1 ms 384 KB Output is correct
22 Correct 1 ms 384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 384 KB Output is correct
2 Correct 0 ms 384 KB Output is correct
3 Runtime error 5 ms 2176 KB Execution killed with signal 11
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 65 ms 21868 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 384 KB Output is correct
2 Correct 1 ms 384 KB Output is correct
3 Correct 1 ms 384 KB Output is correct
4 Correct 1 ms 384 KB Output is correct
5 Correct 0 ms 384 KB Output is correct
6 Correct 1 ms 384 KB Output is correct
7 Correct 0 ms 384 KB Output is correct
8 Correct 1 ms 384 KB Output is correct
9 Correct 0 ms 384 KB Output is correct
10 Correct 1 ms 384 KB Output is correct
11 Correct 1 ms 384 KB Output is correct
12 Correct 1 ms 384 KB Output is correct
13 Correct 1 ms 384 KB Output is correct
14 Correct 1 ms 384 KB Output is correct
15 Correct 0 ms 384 KB Output is correct
16 Correct 1 ms 384 KB Output is correct
17 Correct 0 ms 384 KB Output is correct
18 Correct 1 ms 384 KB Output is correct
19 Correct 0 ms 384 KB Output is correct
20 Correct 0 ms 384 KB Output is correct
21 Correct 1 ms 384 KB Output is correct
22 Correct 1 ms 384 KB Output is correct
23 Correct 1 ms 512 KB Output is correct
24 Correct 1 ms 512 KB Output is correct
25 Correct 1 ms 512 KB Output is correct
26 Correct 1 ms 384 KB Output is correct
27 Correct 0 ms 384 KB Output is correct
28 Runtime error 13 ms 4224 KB Execution killed with signal 11
29 Halted 0 ms 0 KB -