Submission #1027938

# Submission time Handle Problem Language Result Execution time Memory
1027938 2024-07-19T11:49:06 Z mansur Tiles (BOI24_tiles) C++17
15 / 100
39 ms 3160 KB
#include<bits/stdc++.h>

using namespace std;

#define rall(s) s.rbegin(), s.rend()
#define all(s) s.begin(), s.end()
#define sz(s) (int)s.size()
#define s second
#define f first

using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

const int N = 1e6;
const int inf = 1e9;

void solve() {
	int n, m;
	cin >> n >> m;
	int x[n + 1], y[n + 1];
	for (int i = 1; i <= n; i++) {
		cin >> x[i] >> y[i];
	}
	if (n <= 4) {
		sort(y + 1, y + n + 1);
		if ((y[n] - y[1]) & 1) cout << 0 << ' ';
		else cout << m - (m & 1);
		return;
	}
	for (int i = 1; i <= n; i++) {
		if (i > 1 && i < n && ((x[i - 1] == x[i] && x[i] == x[i + 1]) || (y[i - 1] == y[i] && y[i] == y[i + 1]))) continue;
		if ((y[i] & 1) || (x[i] & 1)) {
			cout << x[i] - (x[i] & 1);
			return;
		}
	}
	cout << m - (m & 1);
}

int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	solve();
}
# Verdict Execution time Memory Grader output
1 Correct 0 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 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 1 ms 344 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 Correct 0 ms 348 KB Output is correct
11 Correct 1 ms 344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 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 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 1 ms 344 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 Correct 0 ms 348 KB Output is correct
11 Correct 1 ms 344 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Incorrect 0 ms 348 KB Output isn't correct
14 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 5 ms 604 KB Output is correct
3 Correct 25 ms 1884 KB Output is correct
4 Correct 14 ms 1116 KB Output is correct
5 Correct 13 ms 1236 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 27 ms 1884 KB Output is correct
9 Correct 15 ms 1116 KB Output is correct
10 Correct 26 ms 1884 KB Output is correct
11 Correct 11 ms 1112 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 39 ms 2520 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 1 ms 348 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
# 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 Correct 0 ms 348 KB Output is correct
2 Correct 13 ms 1232 KB Output is correct
3 Correct 13 ms 1116 KB Output is correct
4 Incorrect 16 ms 2020 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 25 ms 1880 KB Output is correct
2 Correct 15 ms 3160 KB Output is correct
3 Incorrect 0 ms 348 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 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 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 1 ms 344 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 Correct 0 ms 348 KB Output is correct
11 Correct 1 ms 344 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Incorrect 0 ms 348 KB Output isn't correct
14 Halted 0 ms 0 KB -