답안 #1049389

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1049389 2024-08-08T17:51:06 Z Huseyn123 Vision Program (IOI19_vision) C++17
0 / 100
23 ms 3032 KB
#include <bits/stdc++.h> 
#define pb push_back
#include "vision.h"
using namespace std;
void construct_network(int H, int W, int K) {
	if(H*W==2){
		return;
	}
	int zero,one;
	vector<int> c[2];
	for(int i=0;i<H;i++){
		vector<int> d;
		for(int j=0;j<W;j++){
			d.pb(i*W+j);
		}
		c[0].pb(add_or(d));
	}
	zero=add_and({0,1,2}); 
	one=add_or(c[0]);
	// H query
	for(int i=0;i<W;i++){
		vector<int> d;
		for(int j=0;j<H;j++){
			d.pb(j*W+i);
		}
		c[1].pb(add_or(d));
	}
	// W query
	vector<int> e[2][8];
	int f[2][8];
	for(int i=0;i<H;i++){
		vector<int> d[8];
		for(int j=i+1;j<H;j++){
			for(int z=0;z<8;z++){
				if(((j-i)&(1<<z))){
					d[z].pb(c[0][j]);
				}
			}
		}
		for(int j=0;j<8;j++){
			d[j].pb(zero);
			e[0][j].pb(add_and({c[0][i],add_or(d[j])}));
		}
	}
	// H*8*2 query
	for(int i=0;i<W;i++){
		vector<int> d[8];
		for(int j=i+1;j<W;j++){
			for(int z=0;z<8;z++){
				if(((j-i)&(1<<z))){
					d[z].pb(c[1][j]);
				}
			}
		}
		for(int j=0;j<8;j++){
			d[j].pb(zero);
			e[1][j].pb(add_and({c[1][i],add_or(d[j])}));
		}
	}
	// W*8*2 query 
	for(int i=0;i<8;i++){
		e[0][i].pb(zero); 
		e[1][i].pb(zero);
		f[0][i]=add_or(e[0][i]);
		f[1][i]=add_or(e[1][i]);
	}
	// 8*2 query
	vector<int> res;
	for(int i=0;i<=K;i++){
		vector<int> d1,d2;
		for(int j=0;j<8;j++){
			if((i&(1<<j))){
				d1.pb(f[0][j]);
			}
			else{
				d2.pb(f[0][j]);
			}
		}
		int h1,h2;
		if(i==0){
			h1=add_not(add_or(d2));
		}
		else{
			h1=add_and({add_and(d1),add_not(add_or(d2))});
		}
		int num=K-i;
		d1.clear(); 
		d2.clear();
		for(int j=0;j<8;j++){
			if((num&(1<<j))){
				d1.pb(f[1][j]);
			}
			else{
				d2.pb(f[1][j]);
			}
		}
		if(num==0){
			h2=add_not(add_or(d2));
		}
		else{
			h2=add_and({add_and(d1),add_not(add_or(d2))});
		}
		res.pb(add_and({h1,h2}));
	}
	add_or(res);
	//(H+w-1)*7
}

Compilation message

vision.cpp: In function 'void construct_network(int, int, int)':
vision.cpp:9:11: warning: variable 'one' set but not used [-Wunused-but-set-variable]
    9 |  int zero,one;
      |           ^~~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 344 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 440 KB Output is correct
16 Correct 0 ms 436 KB Output is correct
17 Incorrect 0 ms 348 KB Integer parameter [name=num_gates] equals to 0, violates the range [1, 10000]
18 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 344 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 440 KB Output is correct
16 Correct 0 ms 436 KB Output is correct
17 Incorrect 0 ms 348 KB Integer parameter [name=num_gates] equals to 0, violates the range [1, 10000]
18 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 344 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 440 KB Output is correct
16 Correct 0 ms 436 KB Output is correct
17 Incorrect 0 ms 348 KB Integer parameter [name=num_gates] equals to 0, violates the range [1, 10000]
18 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 344 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 440 KB Output is correct
16 Correct 0 ms 436 KB Output is correct
17 Incorrect 0 ms 348 KB Integer parameter [name=num_gates] equals to 0, violates the range [1, 10000]
18 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 10 ms 1060 KB Output is correct
2 Correct 5 ms 1236 KB Output is correct
3 Correct 8 ms 1240 KB Output is correct
4 Correct 6 ms 1240 KB Output is correct
5 Correct 5 ms 1116 KB Output is correct
6 Correct 7 ms 1116 KB Output is correct
7 Correct 5 ms 1240 KB Output is correct
8 Correct 5 ms 1240 KB Output is correct
9 Correct 4 ms 1116 KB Output is correct
10 Correct 4 ms 1244 KB Output is correct
11 Correct 6 ms 1240 KB Output is correct
12 Correct 8 ms 1240 KB Output is correct
13 Correct 5 ms 1240 KB Output is correct
14 Correct 5 ms 1240 KB Output is correct
15 Correct 4 ms 1116 KB Output is correct
16 Correct 8 ms 1084 KB Output is correct
17 Correct 6 ms 1236 KB Output is correct
18 Correct 5 ms 1240 KB Output is correct
19 Correct 9 ms 1264 KB Output is correct
20 Correct 5 ms 1240 KB Output is correct
21 Incorrect 0 ms 348 KB Integer parameter [name=num_gates] equals to 0, violates the range [1, 10000]
22 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 2 ms 860 KB Output is correct
4 Correct 2 ms 812 KB Output is correct
5 Correct 2 ms 860 KB Output is correct
6 Correct 2 ms 860 KB Output is correct
7 Correct 3 ms 760 KB Output is correct
8 Correct 3 ms 856 KB Output is correct
9 Correct 3 ms 860 KB Output is correct
10 Correct 6 ms 992 KB Output is correct
11 Correct 6 ms 980 KB Output is correct
12 Correct 6 ms 980 KB Output is correct
13 Correct 4 ms 1212 KB Output is correct
14 Correct 4 ms 1244 KB Output is correct
15 Correct 4 ms 1304 KB Output is correct
16 Correct 5 ms 1324 KB Output is correct
17 Correct 4 ms 1116 KB Output is correct
18 Correct 5 ms 1240 KB Output is correct
19 Correct 5 ms 1320 KB Output is correct
20 Correct 7 ms 2008 KB Output is correct
21 Correct 8 ms 2008 KB Output is correct
22 Correct 8 ms 2004 KB Output is correct
23 Incorrect 1 ms 1240 KB WA in grader: Instruction with no inputs
24 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 13 ms 3032 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 2 ms 856 KB Output is correct
4 Correct 3 ms 860 KB Output is correct
5 Correct 4 ms 1116 KB Output is correct
6 Correct 5 ms 1116 KB Output is correct
7 Correct 7 ms 2004 KB Output is correct
8 Correct 8 ms 2008 KB Output is correct
9 Correct 23 ms 3028 KB Output is correct
10 Incorrect 0 ms 348 KB Integer parameter [name=num_gates] equals to 0, violates the range [1, 10000]
11 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 344 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 440 KB Output is correct
16 Correct 0 ms 436 KB Output is correct
17 Incorrect 0 ms 348 KB Integer parameter [name=num_gates] equals to 0, violates the range [1, 10000]
18 Halted 0 ms 0 KB -