Submission #448701

# Submission time Handle Problem Language Result Execution time Memory
448701 2021-07-31T19:27:20 Z PedroBigMan Vision Program (IOI19_vision) C++14
0 / 100
1 ms 460 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(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) {continue;}
			cell.pb(i*W+j);
		}
		add_or(cell);
	}
	index1=H*W; index2=H*W+H+W-1; index3=H*W+2*(H+W-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);}
		index4=add_or(cell)+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);}
		index5=add_or(cell)+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: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;
      |                                                                      ^~~~~~
vision.cpp:101:33: warning: 'index9' may be used uninitialized in this function [-Wmaybe-uninitialized]
  101 |  add_and({index9,index9+1,index9+2});
      |                           ~~~~~~^~
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 204 KB WA in grader: Invalid index
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 204 KB WA in grader: Invalid index
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 204 KB WA in grader: Invalid index
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 204 KB WA in grader: Invalid index
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 204 KB WA in grader: Invalid index
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 204 KB WA in grader: Invalid index
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 460 KB WA in grader: Invalid index
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 204 KB WA in grader: Invalid index
2 Halted 0 ms 0 KB -