Submission #448702

# Submission time Handle Problem Language Result Execution time Memory
448702 2021-07-31T19:38:36 Z PedroBigMan Vision Program (IOI19_vision) C++14
0 / 100
50 ms 4844 KB
#include "vision.h"
/*
Author of all code: Pedro BIGMAN Dias
Last edit: 15/02/2021
*/
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
#pragma GCC optimize("Ofast")
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <string>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <queue>
#include <deque>
#include <list>
#include <iomanip>
#include <stdlib.h>
#include <time.h>
#include <cstring>
using namespace std;
typedef int ll;
typedef unsigned long long int ull;
typedef long double ld;
#define REP(i,a,b) for(ll i=(ll) a; i<(ll) b; i++)
#define pb push_back
#define mp make_pair
#define pl pair<ll,ll>
#define ff first
#define ss second
#define whole(x) x.begin(),x.end()
#define DEBUG(i) cout<<"Pedro Is The Master "<<i<<endl
#define INF 500000000LL
#define EPS 0.00000001
#define pi 3.14159
ll mod=1000000007LL;

template<class A=ll> 
void Out(vector<A> a) {REP(i,0,a.size()) {cout<<a[i]<<" ";} cout<<endl;}

template<class A=ll>
void In(vector<A> &a, ll N) {A cur; REP(i,0,N) {cin>>cur; a.pb(cur);}} 

void construct_network(int H, int W, int K) 
{
	vector<ll> cell; ll index,index1,index2,index3,index4,index5,index6,index7,index8,index9;
	REP(i,0,H*W) {cell.pb(i);} add_or(cell);
	REP(s,0,H+W-1)
	{
		cell.clear();
		REP(i,0,min(s,H)+1)
		{
			ll j = s-i;
			if(j>=W) {continue;}
			cell.pb(i*W+j);
		}
		add_or(cell); 
	}
	REP(s,-W+1,H)
	{
		cell.clear();
		REP(i,s,s+W)
		{
			ll j = i-s;
			if(j<0 || j>=W || i<0 || i>=H) {continue;}
			cell.pb(i*W+j);
		}
		add_or(cell);
	}
	index1=H*W+1; index2=H*W+H+W; index3=H*W+2*(H+W-1)+1;
	REP(i,0,H+W-1-K)
	{
		cell.clear();
		REP(j,0,i) {cell.pb(index1+j);}
		REP(j,i+K+1,H+W-1) {cell.pb(index1+j);}
		if(cell.size()!=0) {index4=add_or(cell)+1;} else {index4=add_not(H*W)+1;}
	}
	REP(i,0,H+W-1-K)
	{
		cell.clear();
		REP(j,0,i) {cell.pb(index2+j);}
		REP(j,i+K+1,H+W-1) {cell.pb(index2+j);}
		if(cell.size()!=0) {index5=add_or(cell)+1;} else {index5=add_not(H*W)+1;}
	}
	REP(i,0,H+W-1-K) {index6=add_not(index3+i)+1;}
	REP(i,0,H+W-1-K) {index7=add_not(index4+i)+1;}
	REP(i,0,H+W-1-K) {index8=add_and({index1+i,index1+i+K})+1;}
	REP(i,0,H+W-1-K) {index9=add_and({index2+i,index2+i+K})+1;}
	cell.clear();
	REP(i,0,H+W-1-K) {cell.pb(index5+i);}
	add_or(cell);
	cell.clear();
	REP(i,0,H+W-1-K) {cell.pb(index6+i);}
	add_or(cell);
	cell.clear();
	REP(i,0,2*(H+W-1-K)) {cell.pb(index7+i);}
	add_or(cell);
	add_and({index9,index9+1,index9+2});
}

Compilation message

vision.cpp:6: warning: ignoring '#pragma GCC optimization' [-Wunknown-pragmas]
    6 | #pragma GCC optimization ("O3")
      | 
vision.cpp:7: warning: ignoring '#pragma GCC optimization' [-Wunknown-pragmas]
    7 | #pragma GCC optimization ("unroll-loops")
      | 
vision.cpp: In function 'void construct_network(int, int, int)':
vision.cpp:50:22: warning: unused variable 'index' [-Wunused-variable]
   50 |  vector<ll> cell; ll index,index1,index2,index3,index4,index5,index6,index7,index8,index9;
      |                      ^~~~~
vision.cpp:50:77: warning: variable 'index8' set but not used [-Wunused-but-set-variable]
   50 |  vector<ll> cell; ll index,index1,index2,index3,index4,index5,index6,index7,index8,index9;
      |                                                                             ^~~~~~
vision.cpp:102:33: warning: 'index9' may be used uninitialized in this function [-Wmaybe-uninitialized]
  102 |  add_and({index9,index9+1,index9+2});
      |                           ~~~~~~^~
vision.cpp:50:70: warning: 'index7' may be used uninitialized in this function [-Wmaybe-uninitialized]
   50 |  vector<ll> cell; ll index,index1,index2,index3,index4,index5,index6,index7,index8,index9;
      |                                                                      ^~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 204 KB on inputs (0, 0), (0, 1), expected 1, but computed 0
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 204 KB on inputs (0, 0), (0, 1), expected 1, but computed 0
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 204 KB on inputs (0, 0), (0, 1), expected 1, but computed 0
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 204 KB on inputs (0, 0), (0, 1), expected 1, but computed 0
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 9 ms 972 KB on inputs (0, 0), (0, 1), expected 1, but computed 0
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 204 KB on inputs (0, 0), (0, 1), expected 1, but computed 0
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 50 ms 4844 KB on inputs (80, 199), (81, 199), expected 1, but computed 0
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 204 KB on inputs (0, 0), (0, 1), expected 1, but computed 0
2 Halted 0 ms 0 KB -