Submission #971731

# Submission time Handle Problem Language Result Execution time Memory
971731 2024-04-29T08:20:59 Z Halym2007 Jakarta Skyscrapers (APIO15_skyscraper) C++17
0 / 100
1 ms 496 KB
#include <bits/stdc++.h>
using namespace std;
#define ff first
#define ss second
const int N = 3e4 + 5;
pair <int, int> p[N];

int n, m;

int main () {
//	freopen ("input.txt", "r", stdin);
	cin >> n >> m;
	for (int i = 0; i < m; ++i) {
		cin >> p[i].ff >> p[i].ss;
	}
//	cout << "men";
//	return 0;
	if (m == 2) {
		int x = abs (p[0].ff  - p[1].ff);
		if (x % p[0].ss) {
			cout << "-1\n";
		}
		else {
			cout << x / p[0].ss << "\n";
		}
	}
	else {
		return 0;
		int x = abs (p[0].ff - p[1].ff);
		int jogap = 1e9;
		if (x % p[0].ss == 0) jogap = x / p[0].ff;
//		cout << "men";
		int a1 = abs (p[2].ff - p[0].ff);
		int a2 = abs (p[2].ff - p[1].ff);
		if ((a1 % p[0].ss == 0) and (a2 % p[2].ss == 0)) {
			jogap = min (jogap, a1 / p[0].ss + a2 / p[2].ss);
		}
		if (jogap == 1e9) jogap = -1;
		cout << jogap << "\n";
	}
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 496 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -