답안 #297387

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
297387 2020-09-11T14:25:47 Z kshitij_sodani Vision Program (IOI19_vision) C++14
0 / 100
24 ms 2492 KB
#include <bits/stdc++.h>
using namespace std;
typedef long long llo;
#define a first
#define b second
#define pb push_back
#include "vision.h"

void construct_network(int n, int m, int k) {

	
	int cur=n*m;
	vector<int> de;
	for(int i=0;i<n*m;i++){
		de.pb(i);
	}
	add_or(de);
	int extra=cur;//extra 1 if needed in xor
	cur++;

	vector<int> aa;
	for(int i=0;i<n;i++){
		vector<int> kk;
		for(int j=0;j<m;j++){
			kk.pb(i*m+j);
		}
		add_or(kk);
		aa.pb(cur);
		cur++;
	}
	vector<int> aa2;
	for(int i=0;i<n;i++){
		vector<int> kk;
		for(int j=0;j<=i;j++){
			kk.pb(aa[j]);
		}
		add_xor(kk);
		aa2.pb(cur);
		cur++;
	}
	add_not(aa2.back());
	//return ;
	int xx=cur;
	cur++;
	vector<int> rr;
	for(int i=0;i<n;i++){
		add_and({xx,aa2[i]});
		rr.pb(cur);
		cur++;
	}

	//column
	vector<int> bb;
	for(int i=0;i<m;i++){
		vector<int> kk;
		for(int j=0;j<n;j++){
			kk.pb(i+j*m);
		}
		add_or(kk);
		bb.pb(cur);
		cur++;
	}
//	return;
	vector<int> bb2;
	for(int i=0;i<m;i++){
		vector<int> kk;
		for(int j=0;j<=i;j++){
			kk.pb(bb[j]);
		}
		add_xor(kk);
		bb2.pb(cur);
		cur++;
	}
	//return ;
	add_not(bb2.back());
	int yy=cur;
	cur++;
	vector<int> cc;
	for(int i=0;i<m;i++){
		add_and({yy,bb2[i]});
		cc.pb(cur);
		cur++;
	}
	//return;

	vector<int> mm=rr;
	for(auto j:cc){
		mm.pb(j);
	}
	
	vector<int> pos;
	for(int i=0;i<9;i++){
		add_xor(mm);
		pos.pb(cur);
		cur++;
		if(i<8){
			vector<int> kop;
			int prev=extra;
			for(int j=0;j<mm.size();j++){
				add_xor({prev,mm[j]});
				prev=cur;
				cur++;
				add_and({mm[j],cur-1});
				kop.pb(cur);
				cur++;
			}
			mm=kop;
		}
	}
	add_not(extra);
	int ext2=cur;
	cur++;
	vector<int> pp;
	for(int i=0;i<9;i++){
		if(k&(1<<i)){
			add_xor({extra,pos[i]});
			pp.pb(cur);
		}
		else{
			add_xor({ext2,pos[i]});
			pp.pb(cur);
		}
	}
	add_or(pp);
	cur++;
	add_not(cur-1);










}

Compilation message

vision.cpp: In function 'void construct_network(int, int, int)':
vision.cpp:99:17: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   99 |    for(int j=0;j<mm.size();j++){
      |                ~^~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 384 KB Output is correct
2 Correct 1 ms 256 KB Output is correct
3 Correct 1 ms 256 KB Output is correct
4 Correct 1 ms 384 KB Output is correct
5 Correct 1 ms 384 KB Output is correct
6 Correct 1 ms 256 KB Output is correct
7 Incorrect 1 ms 256 KB on inputs (0, 2), (1, 0), expected 0, but computed 1
8 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 384 KB Output is correct
2 Correct 1 ms 256 KB Output is correct
3 Correct 1 ms 256 KB Output is correct
4 Correct 1 ms 384 KB Output is correct
5 Correct 1 ms 384 KB Output is correct
6 Correct 1 ms 256 KB Output is correct
7 Incorrect 1 ms 256 KB on inputs (0, 2), (1, 0), expected 0, but computed 1
8 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 384 KB Output is correct
2 Correct 1 ms 256 KB Output is correct
3 Correct 1 ms 256 KB Output is correct
4 Correct 1 ms 384 KB Output is correct
5 Correct 1 ms 384 KB Output is correct
6 Correct 1 ms 256 KB Output is correct
7 Incorrect 1 ms 256 KB on inputs (0, 2), (1, 0), expected 0, but computed 1
8 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 384 KB Output is correct
2 Correct 1 ms 256 KB Output is correct
3 Correct 1 ms 256 KB Output is correct
4 Correct 1 ms 384 KB Output is correct
5 Correct 1 ms 384 KB Output is correct
6 Correct 1 ms 256 KB Output is correct
7 Incorrect 1 ms 256 KB on inputs (0, 2), (1, 0), expected 0, but computed 1
8 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 6 ms 768 KB on inputs (0, 0), (0, 3), expected 0, but computed 1
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 256 KB Output is correct
2 Correct 1 ms 256 KB Output is correct
3 Correct 4 ms 768 KB Output is correct
4 Incorrect 4 ms 768 KB on inputs (0, 0), (1, 0), expected 0, but computed 1
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 24 ms 2492 KB on inputs (126, 120), (176, 169), expected 0, but computed 1
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 384 KB Output is correct
2 Correct 1 ms 256 KB Output is correct
3 Correct 1 ms 256 KB Output is correct
4 Correct 1 ms 384 KB Output is correct
5 Correct 1 ms 384 KB Output is correct
6 Correct 1 ms 256 KB Output is correct
7 Incorrect 1 ms 256 KB on inputs (0, 2), (1, 0), expected 0, but computed 1
8 Halted 0 ms 0 KB -