Submission #411374

# Submission time Handle Problem Language Result Execution time Memory
411374 2021-05-25T07:18:04 Z ismoilov Vision Program (IOI19_vision) C++14
0 / 100
4 ms 1052 KB
#include "vision.h"
#include<bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define IOS ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
//#define int ll
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define fp(a,i,c) for(int (a) = (i); (a) < (c); (a)++)
#define fpp(a,i,c) for(int (a) = (i); (a) <= (c); (a)++)
#define fv(a, c) for(int (a) = (1); (a) <= (c); (a)++)
#define fz(a, c) for(int (a) = (0); (a) < (c); (a)++)
#define fm(a,i,c) for(int (a) = (i); (a) > (c); (a)--)
#define fmm(a,i,c) for(int (a) = (i); (a) >= (c); (a)--)
#define pb push_back
#define in insert
#define ss second
#define ff first
#define vi vector <int>
#define fa(a, v) for(auto (a) : (v))
#define mnel(a) *min_element(all(a))
#define mxel(a) *max_element(all(a))
#define si set<int>
#define sov(a) sort(all((a)))
void construct_network(int h, int w, int K) {
	vector<int> ss;
	if(K == 1){
		fp(i,0,h){
			fp(j,0,w){
				int x = i*w+j;
				vi n;
				fpp(k,-1,1){
					int i1 = i + k, j1 = j + (abs(k) - K);
					int i2 = i + k, j2 = j - (abs(k) - K);
					if(i1 >= 0 && i1 < h && j1 >= 0 && j1 < w)
						n.pb(i1*w + j1);
					if(i2 >= 0 && i2 < h && j2 >= 0 && j2 < w)
						n.pb(i2*w + j2);
				}
				ss.pb(add_or(n));
			}
		}
	}
	if(max(h, w) > 10 && min(h, w) != 1){
		int i = 0, j = 0;
		int x = i*w + j;
			fpp(k,-K, K){
				int ii = i + k, jj = j + (abs(k) - K);
				if(ii >= 0 && ii < h && jj >= 0 && jj < w)
					ss.pb(add_and({x, ii*w +jj}));
				ii = i + k, jj = j - (abs(k) - K);
				if(ii >= 0 && ii < h && jj >= 0 && jj < w)
					ss.pb(add_and({x, ii*w +jj}));
		}
	}
	else{
		fp(i,0,h){
			fp(j,0,w){
				int x = i*w + j;
				fpp(k,-K, K){
					int ii = i + k, jj = j + (abs(k) - K);
					if(ii >= 0 && ii < h && jj >= 0 && jj < w)
						ss.pb(add_and({x, ii*w +jj}));
					ii = i + k, jj = j - (abs(k) - K);
					if(ii >= 0 && ii < h && jj >= 0 && jj < w)
						ss.pb(add_and({x, ii*w +jj}));
				}
			}
		}
	}
	add_or(ss);
}

Compilation message

vision.cpp: In function 'void construct_network(int, int, int)':
vision.cpp:14:27: warning: unnecessary parentheses in declaration of 'i' [-Wparentheses]
   14 | #define fp(a,i,c) for(int (a) = (i); (a) < (c); (a)++)
      |                           ^
vision.cpp:33:3: note: in expansion of macro 'fp'
   33 |   fp(i,0,h){
      |   ^~
vision.cpp:14:27: warning: unnecessary parentheses in declaration of 'j' [-Wparentheses]
   14 | #define fp(a,i,c) for(int (a) = (i); (a) < (c); (a)++)
      |                           ^
vision.cpp:34:4: note: in expansion of macro 'fp'
   34 |    fp(j,0,w){
      |    ^~
vision.cpp:15:28: warning: unnecessary parentheses in declaration of 'k' [-Wparentheses]
   15 | #define fpp(a,i,c) for(int (a) = (i); (a) <= (c); (a)++)
      |                            ^
vision.cpp:37:5: note: in expansion of macro 'fpp'
   37 |     fpp(k,-1,1){
      |     ^~~
vision.cpp:35:9: warning: unused variable 'x' [-Wunused-variable]
   35 |     int x = i*w+j;
      |         ^
vision.cpp:15:28: warning: unnecessary parentheses in declaration of 'k' [-Wparentheses]
   15 | #define fpp(a,i,c) for(int (a) = (i); (a) <= (c); (a)++)
      |                            ^
vision.cpp:52:4: note: in expansion of macro 'fpp'
   52 |    fpp(k,-K, K){
      |    ^~~
vision.cpp:14:27: warning: unnecessary parentheses in declaration of 'i' [-Wparentheses]
   14 | #define fp(a,i,c) for(int (a) = (i); (a) < (c); (a)++)
      |                           ^
vision.cpp:62:3: note: in expansion of macro 'fp'
   62 |   fp(i,0,h){
      |   ^~
vision.cpp:14:27: warning: unnecessary parentheses in declaration of 'j' [-Wparentheses]
   14 | #define fp(a,i,c) for(int (a) = (i); (a) < (c); (a)++)
      |                           ^
vision.cpp:63:4: note: in expansion of macro 'fp'
   63 |    fp(j,0,w){
      |    ^~
vision.cpp:15:28: warning: unnecessary parentheses in declaration of 'k' [-Wparentheses]
   15 | #define fpp(a,i,c) for(int (a) = (i); (a) <= (c); (a)++)
      |                            ^
vision.cpp:65:5: note: in expansion of macro 'fpp'
   65 |     fpp(k,-K, K){
      |     ^~~
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 288 KB on inputs (0, 0), (0, 2), expected 0, but computed 1
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 288 KB on inputs (0, 0), (0, 2), expected 0, but computed 1
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 288 KB on inputs (0, 0), (0, 2), expected 0, but computed 1
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 288 KB on inputs (0, 0), (0, 2), expected 0, but computed 1
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 332 KB on inputs (0, 0), (0, 2), expected 0, but computed 1
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 292 KB on inputs (0, 0), (1, 1), expected 0, but computed 1
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 1052 KB WA in grader: Too many instructions
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 288 KB on inputs (0, 0), (0, 2), expected 0, but computed 1
2 Halted 0 ms 0 KB -