Submission #1020959

# Submission time Handle Problem Language Result Execution time Memory
1020959 2024-07-12T12:05:33 Z pawned Vision Program (IOI19_vision) C++17
12 / 100
399 ms 1836 KB
#pragma GCC optimize("O1,O2,O3,Ofast,unroll-loops")

#include <bits/stdc++.h>
using namespace std;

#define fi first
#define se second
#define pb push_back
typedef long long ll;
typedef pair<int, int> ii;
typedef vector<int> vi;

#include "vision.h"

int H, W, K;

ii conv(int x) {
	return {x / W, x % W};
}

int convr(ii p) {
	return (p.fi * W + p.se);
}

int dist(int x, int y) {
	ii r1 = conv(x);
	ii r2 = conv(y);
	int res = abs(r1.fi - r2.fi) + abs(r1.se - r2.se);
	return res;
}

void construct_network(int h, int w, int k) {
	H = h; W = w; K = k;
	int ctr = H * W;	// next query number
	vi tq;
	for (int i = 0; i < H * W; i++) {
//		cout<<"at "<<i<<endl;
		ii pos = conv(i);
		vi v1;
		for (int j = 0; j < H * W; j++) {
			ii pos2 = conv(j);
			if (pos2.fi <= pos.fi && pos.se - pos.fi == pos2.se - pos2.fi - K)
				v1.pb(j);
		}
		if (v1.size() > 0) {
			add_or(v1);
			ctr++;
			add_and({i, ctr - 1});
			tq.pb(ctr);
			ctr++;
		}
		vi v2;
		for (int j = 0; j < H * W; j++) {
			ii pos2 = conv(j);
			if (pos2.fi >= pos.fi && pos.fi + pos.se == pos2.fi + pos2.se - K) {
//				cout<<"orz "<<pos.fi<<" "<<pos.se<<" "<<pos2.fi<<" "<<pos2.se<<endl;
				v2.pb(j);
			}
		}
		if (v2.size() > 0) {
			add_or(v2);
			ctr++;
			add_and({i, ctr - 1});
			tq.pb(ctr);
			ctr++;
		}
	}
//	cout<<"ctr: "<<ctr<<endl;
	add_or(tq);
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 440 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Correct 0 ms 604 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Incorrect 1 ms 344 KB on inputs (0, 1), (2, 0), expected 0, but computed 1
11 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 440 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Correct 0 ms 604 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Incorrect 1 ms 344 KB on inputs (0, 1), (2, 0), expected 0, but computed 1
11 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 440 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Correct 0 ms 604 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Incorrect 1 ms 344 KB on inputs (0, 1), (2, 0), expected 0, but computed 1
11 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 440 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Correct 0 ms 604 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Incorrect 1 ms 344 KB on inputs (0, 1), (2, 0), expected 0, but computed 1
11 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 1 ms 344 KB Output is correct
8 Correct 0 ms 344 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 1 ms 604 KB Output is correct
11 Correct 1 ms 348 KB Output is correct
12 Correct 1 ms 344 KB Output is correct
13 Correct 1 ms 344 KB Output is correct
14 Correct 1 ms 348 KB Output is correct
15 Correct 1 ms 348 KB Output is correct
16 Correct 1 ms 348 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 1 ms 348 KB Output is correct
19 Correct 1 ms 348 KB Output is correct
20 Correct 0 ms 348 KB Output is correct
21 Correct 0 ms 348 KB Output is correct
22 Correct 1 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Incorrect 31 ms 1348 KB WA in grader: Too many instructions
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 399 ms 1836 KB WA in grader: Too many instructions
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 440 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Correct 0 ms 604 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Incorrect 1 ms 344 KB on inputs (0, 1), (2, 0), expected 0, but computed 1
11 Halted 0 ms 0 KB -