Submission #1027789

# Submission time Handle Problem Language Result Execution time Memory
1027789 2024-07-19T09:54:08 Z Issa Tiles (BOI24_tiles) C++17
11 / 100
29 ms 9360 KB
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define ent "\n"

const int maxn = 1e6 + 100;
const ll INF = (ll)1e18 + 100;
const int inf = 1e9 + 100;
const int MOD = 1e9 + 123;
const int maxl = 26;
const int P = 31;

int n, m;
int a[maxn];
int b[maxn];

void test(){
	cin >> n >> m;
	for(int i = 1; i <= n; i++){
		cin >> a[i] >> b[i];
	}
	vector<int> v;
	for(int i = 2; i <= n; i++){
		while(v.size() > 1){
			int k = v[v.size()-2], j = v.back();
			if(a[k] == a[j] && a[j] == a[i]) v.pop_back();
			else if(b[k] == b[j] && b[j] == b[i]) v.pop_back();
			else break;
		} v.push_back(i);
	}
	int ans = 0;
	for(int i: v){
		if((b[i] & 1 )|| !b[i]) break;
		ans = a[i] - (a[i] & 1);
		if(a[i] & 1) break;
	}
	cout << ans;
}

int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    int t; t = 1;
    while(t--) test();
    cout << ent;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 2396 KB Output is correct
2 Correct 0 ms 2396 KB Output is correct
3 Incorrect 0 ms 2396 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 2396 KB Output is correct
2 Correct 0 ms 2396 KB Output is correct
3 Incorrect 0 ms 2396 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2392 KB Output is correct
2 Correct 6 ms 2904 KB Output is correct
3 Correct 27 ms 7896 KB Output is correct
4 Correct 15 ms 7408 KB Output is correct
5 Correct 15 ms 7392 KB Output is correct
6 Correct 0 ms 2396 KB Output is correct
7 Correct 0 ms 2396 KB Output is correct
8 Correct 27 ms 7944 KB Output is correct
9 Correct 15 ms 7440 KB Output is correct
10 Correct 29 ms 8152 KB Output is correct
11 Correct 12 ms 5280 KB Output is correct
12 Correct 0 ms 2396 KB Output is correct
13 Correct 28 ms 8456 KB Output is correct
14 Correct 1 ms 2396 KB Output is correct
15 Correct 0 ms 2396 KB Output is correct
16 Correct 0 ms 2396 KB Output is correct
17 Correct 1 ms 2396 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 2396 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 2396 KB Output is correct
2 Correct 18 ms 7444 KB Output is correct
3 Correct 15 ms 9360 KB Output is correct
4 Incorrect 22 ms 9344 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 28 ms 7900 KB Output is correct
2 Correct 13 ms 7392 KB Output is correct
3 Incorrect 1 ms 2396 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 2396 KB Output is correct
2 Correct 0 ms 2396 KB Output is correct
3 Incorrect 0 ms 2396 KB Output isn't correct
4 Halted 0 ms 0 KB -