Submission #1020942

# Submission time Handle Problem Language Result Execution time Memory
1020942 2024-07-12T11:52:29 Z pawned Vision Program (IOI19_vision) C++17
12 / 100
429 ms 3016 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 (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 (pos.se + pos.fi == pos2.se + pos2.fi - K)
				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 1 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Incorrect 0 ms 348 KB on inputs (0, 2), (1, 0), expected 0, but computed 1
8 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Incorrect 0 ms 348 KB on inputs (0, 2), (1, 0), expected 0, but computed 1
8 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Incorrect 0 ms 348 KB on inputs (0, 2), (1, 0), expected 0, but computed 1
8 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Incorrect 0 ms 348 KB on inputs (0, 2), (1, 0), expected 0, but computed 1
8 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 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 344 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 1 ms 348 KB Output is correct
12 Correct 1 ms 348 KB Output is correct
13 Correct 1 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 1 ms 348 KB Output is correct
16 Correct 1 ms 432 KB Output is correct
17 Correct 1 ms 348 KB Output is correct
18 Correct 2 ms 348 KB Output is correct
19 Correct 0 ms 348 KB Output is correct
20 Correct 1 ms 348 KB Output is correct
21 Correct 0 ms 348 KB Output is correct
22 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Incorrect 34 ms 1376 KB WA in grader: Too many instructions
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 429 ms 3016 KB WA in grader: Too many instructions
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Incorrect 0 ms 348 KB on inputs (0, 2), (1, 0), expected 0, but computed 1
8 Halted 0 ms 0 KB -