Submission #448703

# Submission time Handle Problem Language Result Execution time Memory
448703 2021-07-31T19:45:38 Z PedroBigMan Vision Program (IOI19_vision) C++14
100 / 100
52 ms 4780 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)+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 Correct 1 ms 204 KB Output is correct
2 Correct 0 ms 296 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 296 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Correct 1 ms 204 KB Output is correct
9 Correct 1 ms 204 KB Output is correct
10 Correct 1 ms 204 KB Output is correct
11 Correct 1 ms 204 KB Output is correct
12 Correct 1 ms 204 KB Output is correct
13 Correct 1 ms 204 KB Output is correct
14 Correct 1 ms 292 KB Output is correct
15 Correct 1 ms 204 KB Output is correct
16 Correct 1 ms 288 KB Output is correct
17 Correct 1 ms 204 KB Output is correct
18 Correct 0 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 0 ms 296 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 296 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Correct 1 ms 204 KB Output is correct
9 Correct 1 ms 204 KB Output is correct
10 Correct 1 ms 204 KB Output is correct
11 Correct 1 ms 204 KB Output is correct
12 Correct 1 ms 204 KB Output is correct
13 Correct 1 ms 204 KB Output is correct
14 Correct 1 ms 292 KB Output is correct
15 Correct 1 ms 204 KB Output is correct
16 Correct 1 ms 288 KB Output is correct
17 Correct 1 ms 204 KB Output is correct
18 Correct 0 ms 204 KB Output is correct
19 Correct 1 ms 204 KB Output is correct
20 Correct 1 ms 204 KB Output is correct
21 Correct 1 ms 204 KB Output is correct
22 Correct 1 ms 204 KB Output is correct
23 Correct 1 ms 292 KB Output is correct
24 Correct 1 ms 288 KB Output is correct
25 Correct 1 ms 204 KB Output is correct
26 Correct 1 ms 204 KB Output is correct
27 Correct 1 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 0 ms 296 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 296 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Correct 1 ms 204 KB Output is correct
9 Correct 1 ms 204 KB Output is correct
10 Correct 1 ms 204 KB Output is correct
11 Correct 1 ms 204 KB Output is correct
12 Correct 1 ms 204 KB Output is correct
13 Correct 1 ms 204 KB Output is correct
14 Correct 1 ms 292 KB Output is correct
15 Correct 1 ms 204 KB Output is correct
16 Correct 1 ms 288 KB Output is correct
17 Correct 1 ms 204 KB Output is correct
18 Correct 0 ms 204 KB Output is correct
19 Correct 1 ms 204 KB Output is correct
20 Correct 1 ms 204 KB Output is correct
21 Correct 1 ms 204 KB Output is correct
22 Correct 1 ms 204 KB Output is correct
23 Correct 1 ms 292 KB Output is correct
24 Correct 1 ms 288 KB Output is correct
25 Correct 1 ms 204 KB Output is correct
26 Correct 1 ms 204 KB Output is correct
27 Correct 1 ms 204 KB Output is correct
28 Correct 2 ms 332 KB Output is correct
29 Correct 1 ms 204 KB Output is correct
30 Correct 1 ms 204 KB Output is correct
31 Correct 1 ms 204 KB Output is correct
32 Correct 1 ms 332 KB Output is correct
33 Correct 2 ms 332 KB Output is correct
34 Correct 2 ms 332 KB Output is correct
35 Correct 1 ms 292 KB Output is correct
36 Correct 1 ms 332 KB Output is correct
37 Correct 1 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 0 ms 296 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 296 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Correct 1 ms 204 KB Output is correct
9 Correct 1 ms 204 KB Output is correct
10 Correct 1 ms 204 KB Output is correct
11 Correct 1 ms 204 KB Output is correct
12 Correct 1 ms 204 KB Output is correct
13 Correct 1 ms 204 KB Output is correct
14 Correct 1 ms 292 KB Output is correct
15 Correct 1 ms 204 KB Output is correct
16 Correct 1 ms 288 KB Output is correct
17 Correct 1 ms 204 KB Output is correct
18 Correct 0 ms 204 KB Output is correct
19 Correct 1 ms 204 KB Output is correct
20 Correct 1 ms 204 KB Output is correct
21 Correct 1 ms 204 KB Output is correct
22 Correct 1 ms 204 KB Output is correct
23 Correct 1 ms 292 KB Output is correct
24 Correct 1 ms 288 KB Output is correct
25 Correct 1 ms 204 KB Output is correct
26 Correct 1 ms 204 KB Output is correct
27 Correct 1 ms 204 KB Output is correct
28 Correct 2 ms 332 KB Output is correct
29 Correct 1 ms 204 KB Output is correct
30 Correct 1 ms 204 KB Output is correct
31 Correct 1 ms 204 KB Output is correct
32 Correct 1 ms 332 KB Output is correct
33 Correct 2 ms 332 KB Output is correct
34 Correct 2 ms 332 KB Output is correct
35 Correct 1 ms 292 KB Output is correct
36 Correct 1 ms 332 KB Output is correct
37 Correct 1 ms 204 KB Output is correct
38 Correct 9 ms 1100 KB Output is correct
39 Correct 2 ms 332 KB Output is correct
40 Correct 1 ms 204 KB Output is correct
41 Correct 7 ms 892 KB Output is correct
42 Correct 2 ms 460 KB Output is correct
43 Correct 13 ms 1480 KB Output is correct
44 Correct 10 ms 1084 KB Output is correct
45 Correct 6 ms 844 KB Output is correct
46 Correct 5 ms 692 KB Output is correct
47 Correct 4 ms 588 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 9 ms 972 KB Output is correct
2 Correct 3 ms 460 KB Output is correct
3 Correct 3 ms 464 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 10 ms 972 KB Output is correct
6 Correct 5 ms 672 KB Output is correct
7 Correct 2 ms 404 KB Output is correct
8 Correct 1 ms 204 KB Output is correct
9 Correct 10 ms 972 KB Output is correct
10 Correct 6 ms 716 KB Output is correct
11 Correct 3 ms 460 KB Output is correct
12 Correct 3 ms 460 KB Output is correct
13 Correct 1 ms 332 KB Output is correct
14 Correct 1 ms 204 KB Output is correct
15 Correct 11 ms 1028 KB Output is correct
16 Correct 8 ms 716 KB Output is correct
17 Correct 3 ms 460 KB Output is correct
18 Correct 3 ms 460 KB Output is correct
19 Correct 1 ms 288 KB Output is correct
20 Correct 1 ms 204 KB Output is correct
21 Correct 0 ms 204 KB Output is correct
22 Correct 1 ms 292 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 5 ms 716 KB Output is correct
4 Correct 4 ms 588 KB Output is correct
5 Correct 3 ms 460 KB Output is correct
6 Correct 2 ms 332 KB Output is correct
7 Correct 2 ms 332 KB Output is correct
8 Correct 12 ms 1100 KB Output is correct
9 Correct 7 ms 808 KB Output is correct
10 Correct 5 ms 588 KB Output is correct
11 Correct 3 ms 460 KB Output is correct
12 Correct 3 ms 460 KB Output is correct
13 Correct 10 ms 972 KB Output is correct
14 Correct 7 ms 588 KB Output is correct
15 Correct 2 ms 332 KB Output is correct
16 Correct 1 ms 332 KB Output is correct
17 Correct 9 ms 1000 KB Output is correct
18 Correct 3 ms 420 KB Output is correct
19 Correct 1 ms 204 KB Output is correct
20 Correct 34 ms 2796 KB Output is correct
21 Correct 17 ms 1764 KB Output is correct
22 Correct 10 ms 1148 KB Output is correct
23 Correct 8 ms 856 KB Output is correct
24 Correct 28 ms 2764 KB Output is correct
25 Correct 13 ms 1404 KB Output is correct
26 Correct 11 ms 892 KB Output is correct
27 Correct 50 ms 4780 KB Output is correct
28 Correct 44 ms 3380 KB Output is correct
29 Correct 24 ms 2368 KB Output is correct
30 Correct 19 ms 1680 KB Output is correct
31 Correct 14 ms 1480 KB Output is correct
32 Correct 0 ms 204 KB Output is correct
33 Correct 0 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 50 ms 4760 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 5 ms 728 KB Output is correct
4 Correct 10 ms 1060 KB Output is correct
5 Correct 10 ms 980 KB Output is correct
6 Correct 10 ms 1032 KB Output is correct
7 Correct 28 ms 2816 KB Output is correct
8 Correct 28 ms 2816 KB Output is correct
9 Correct 52 ms 4736 KB Output is correct
10 Correct 1 ms 204 KB Output is correct
11 Correct 0 ms 296 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 0 ms 296 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 296 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Correct 1 ms 204 KB Output is correct
9 Correct 1 ms 204 KB Output is correct
10 Correct 1 ms 204 KB Output is correct
11 Correct 1 ms 204 KB Output is correct
12 Correct 1 ms 204 KB Output is correct
13 Correct 1 ms 204 KB Output is correct
14 Correct 1 ms 292 KB Output is correct
15 Correct 1 ms 204 KB Output is correct
16 Correct 1 ms 288 KB Output is correct
17 Correct 1 ms 204 KB Output is correct
18 Correct 0 ms 204 KB Output is correct
19 Correct 1 ms 204 KB Output is correct
20 Correct 1 ms 204 KB Output is correct
21 Correct 1 ms 204 KB Output is correct
22 Correct 1 ms 204 KB Output is correct
23 Correct 1 ms 292 KB Output is correct
24 Correct 1 ms 288 KB Output is correct
25 Correct 1 ms 204 KB Output is correct
26 Correct 1 ms 204 KB Output is correct
27 Correct 1 ms 204 KB Output is correct
28 Correct 2 ms 332 KB Output is correct
29 Correct 1 ms 204 KB Output is correct
30 Correct 1 ms 204 KB Output is correct
31 Correct 1 ms 204 KB Output is correct
32 Correct 1 ms 332 KB Output is correct
33 Correct 2 ms 332 KB Output is correct
34 Correct 2 ms 332 KB Output is correct
35 Correct 1 ms 292 KB Output is correct
36 Correct 1 ms 332 KB Output is correct
37 Correct 1 ms 204 KB Output is correct
38 Correct 9 ms 1100 KB Output is correct
39 Correct 2 ms 332 KB Output is correct
40 Correct 1 ms 204 KB Output is correct
41 Correct 7 ms 892 KB Output is correct
42 Correct 2 ms 460 KB Output is correct
43 Correct 13 ms 1480 KB Output is correct
44 Correct 10 ms 1084 KB Output is correct
45 Correct 6 ms 844 KB Output is correct
46 Correct 5 ms 692 KB Output is correct
47 Correct 4 ms 588 KB Output is correct
48 Correct 9 ms 972 KB Output is correct
49 Correct 3 ms 460 KB Output is correct
50 Correct 3 ms 464 KB Output is correct
51 Correct 1 ms 204 KB Output is correct
52 Correct 10 ms 972 KB Output is correct
53 Correct 5 ms 672 KB Output is correct
54 Correct 2 ms 404 KB Output is correct
55 Correct 1 ms 204 KB Output is correct
56 Correct 10 ms 972 KB Output is correct
57 Correct 6 ms 716 KB Output is correct
58 Correct 3 ms 460 KB Output is correct
59 Correct 3 ms 460 KB Output is correct
60 Correct 1 ms 332 KB Output is correct
61 Correct 1 ms 204 KB Output is correct
62 Correct 11 ms 1028 KB Output is correct
63 Correct 8 ms 716 KB Output is correct
64 Correct 3 ms 460 KB Output is correct
65 Correct 3 ms 460 KB Output is correct
66 Correct 1 ms 288 KB Output is correct
67 Correct 1 ms 204 KB Output is correct
68 Correct 0 ms 204 KB Output is correct
69 Correct 1 ms 292 KB Output is correct
70 Correct 0 ms 204 KB Output is correct
71 Correct 0 ms 204 KB Output is correct
72 Correct 5 ms 716 KB Output is correct
73 Correct 4 ms 588 KB Output is correct
74 Correct 3 ms 460 KB Output is correct
75 Correct 2 ms 332 KB Output is correct
76 Correct 2 ms 332 KB Output is correct
77 Correct 12 ms 1100 KB Output is correct
78 Correct 7 ms 808 KB Output is correct
79 Correct 5 ms 588 KB Output is correct
80 Correct 3 ms 460 KB Output is correct
81 Correct 3 ms 460 KB Output is correct
82 Correct 10 ms 972 KB Output is correct
83 Correct 7 ms 588 KB Output is correct
84 Correct 2 ms 332 KB Output is correct
85 Correct 1 ms 332 KB Output is correct
86 Correct 9 ms 1000 KB Output is correct
87 Correct 3 ms 420 KB Output is correct
88 Correct 1 ms 204 KB Output is correct
89 Correct 34 ms 2796 KB Output is correct
90 Correct 17 ms 1764 KB Output is correct
91 Correct 10 ms 1148 KB Output is correct
92 Correct 8 ms 856 KB Output is correct
93 Correct 28 ms 2764 KB Output is correct
94 Correct 13 ms 1404 KB Output is correct
95 Correct 11 ms 892 KB Output is correct
96 Correct 50 ms 4780 KB Output is correct
97 Correct 44 ms 3380 KB Output is correct
98 Correct 24 ms 2368 KB Output is correct
99 Correct 19 ms 1680 KB Output is correct
100 Correct 14 ms 1480 KB Output is correct
101 Correct 0 ms 204 KB Output is correct
102 Correct 0 ms 204 KB Output is correct
103 Correct 50 ms 4760 KB Output is correct
104 Correct 1 ms 204 KB Output is correct
105 Correct 5 ms 728 KB Output is correct
106 Correct 10 ms 1060 KB Output is correct
107 Correct 10 ms 980 KB Output is correct
108 Correct 10 ms 1032 KB Output is correct
109 Correct 28 ms 2816 KB Output is correct
110 Correct 28 ms 2816 KB Output is correct
111 Correct 52 ms 4736 KB Output is correct
112 Correct 1 ms 204 KB Output is correct
113 Correct 0 ms 296 KB Output is correct
114 Correct 36 ms 3364 KB Output is correct
115 Correct 1 ms 204 KB Output is correct
116 Correct 10 ms 972 KB Output is correct
117 Correct 8 ms 892 KB Output is correct
118 Correct 22 ms 2200 KB Output is correct
119 Correct 24 ms 2312 KB Output is correct
120 Correct 23 ms 2332 KB Output is correct
121 Correct 24 ms 2284 KB Output is correct
122 Correct 24 ms 2308 KB Output is correct
123 Correct 50 ms 4776 KB Output is correct
124 Correct 35 ms 3420 KB Output is correct
125 Correct 25 ms 2380 KB Output is correct
126 Correct 24 ms 2304 KB Output is correct
127 Correct 17 ms 1672 KB Output is correct
128 Correct 14 ms 1516 KB Output is correct