Submission #1029789

# Submission time Handle Problem Language Result Execution time Memory
1029789 2024-07-21T10:34:47 Z mindiyak Vision Program (IOI19_vision) C++14
0 / 100
2 ms 2392 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;

vvi asked(500,vi(500,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;

	vi visited(500,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);
			}
		}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--;
			}
		}
	}
}

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 1 ms 1372 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 1 ms 1372 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 1 ms 1372 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 1 ms 1372 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 1 ms 1368 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 1372 KB Output is correct
2 Correct 1 ms 1372 KB Output is correct
3 Correct 1 ms 1628 KB Output is correct
4 Runtime error 2 ms 2392 KB Execution killed with signal 6
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 1368 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 1 ms 1372 KB on inputs (0, 1), (0, 2), expected 1, but computed 0
2 Halted 0 ms 0 KB -