Submission #1029803

# Submission time Handle Problem Language Result Execution time Memory
1029803 2024-07-21T10:44:23 Z mindiyak Vision Program (IOI19_vision) C++14
8 / 100
12 ms 616 KB
#include "vision.h"
#pragma GCC optimize("O1,O2,O3,Ofast,unroll-loops")
#include <bits/stdc++.h>
#include <string>
// #include <iostream>
#include <cmath>
#include <numeric>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int, int> pi;
typedef pair<int, int> pl;
typedef pair<ld, ld> pd;
typedef vector<int> vi;
typedef vector<bool> vb;
typedef vector<vector<int>> vvi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
#define FOR(i, a, b) for (int i = a; i < (b); i++)
#define F0R(i, a) for (int i = 0; i < (a); i++)
#define FORd(i, a, b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i, a) for (int i = (a)-1; i >= 0; i--)
#define trav(a, x) for (auto &a : x)
#define uid(a, b) uniform_int_distribution<int>(a, b)(rng)
#define len(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define F first
#define nl endl
#define S second
#define lb lower_bound
#define ub upper_bound
#define aint(x) x.begin(), x.end()
#define raint(x) x.rbegin(), x.rend()
#define ins insert
const int MOD = 1000000007;

// vector<vector<int>> asked(10005,vector<int>(10005,0));
vi check;
int K,H,W;

int convert(pi a){return (W*a.F)+a.S;}

void dfs(pi start){
	priority_queue<pair<int,pi>> arr;

	vector<int> visited(H*W+5,0);
	arr.push({0,start});

	int i = convert(start);
	while(!arr.empty()){
		int dist = -arr.top().F;
		pi node = arr.top().S;
		int j = convert(node);
		arr.pop();
		if(visited[j])continue;
		visited[j] = 1;
		if(dist == K){
			// cout << start.F << "," << start.S << " | " << node.F << "," << node.S << " " << dist << endl;
			// if(!asked[i][j]){
			// 	asked[i][j] = 1;
			// 	asked[j][i] = 1;
			// 	vi q = {i,j};
			// 	int a = add_and(q);
			// 	// cout << a << endl;
			// 	check.pb(a);
			// }
			vi q = {i,j};
			int a = add_and(q);
			// cout << a << endl;
			check.pb(a);
		}else if(dist < K){
			if(node.F < H-1){
				node.F++;
				arr.push({-dist-1,node});
				node.F--;
			}
			if(node.F >= 1){
				node.F--;
				arr.push({-dist-1,node});
				node.F++;
			}
			if(node.S >= 1){
				node.S--;
				arr.push({-dist-1,node});
				node.S++;
			}
			if(node.S < W-1){
				node.S++;
				arr.push({-dist-1,node});
				node.S--;
			}
		}
	}

	visited.clear();
}

void construct_network(int H_, int W_, int K_) {
	H = H_;W = W_;K = K_;

	// FOR(i,0,H){
	// 	FOR(j,0,W){
	// 		dfs({i,j});
	// 	}
	// }
	dfs({0,0});
	add_or(check);
}
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB on inputs (0, 1), (0, 2), expected 1, but computed 0
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB on inputs (0, 1), (0, 2), expected 1, but computed 0
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB on inputs (0, 1), (0, 2), expected 1, but computed 0
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB on inputs (0, 1), (0, 2), expected 1, but computed 0
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB on inputs (0, 1), (0, 2), expected 1, but computed 0
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 440 KB Output is correct
5 Correct 1 ms 432 KB Output is correct
6 Correct 1 ms 616 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 2 ms 348 KB Output is correct
12 Correct 2 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 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 0 ms 348 KB Output is correct
19 Correct 0 ms 348 KB Output is correct
20 Correct 0 ms 348 KB Output is correct
21 Correct 2 ms 348 KB Output is correct
22 Correct 5 ms 348 KB Output is correct
23 Correct 6 ms 344 KB Output is correct
24 Correct 0 ms 348 KB Output is correct
25 Correct 3 ms 520 KB Output is correct
26 Correct 6 ms 348 KB Output is correct
27 Correct 0 ms 604 KB Output is correct
28 Correct 2 ms 604 KB Output is correct
29 Correct 7 ms 604 KB Output is correct
30 Correct 11 ms 604 KB Output is correct
31 Correct 12 ms 604 KB Output is correct
32 Correct 0 ms 348 KB Output is correct
33 Correct 1 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 604 KB on inputs (80, 199), (81, 199), expected 1, but computed 0
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB on inputs (0, 1), (0, 2), expected 1, but computed 0
2 Halted 0 ms 0 KB -