Submission #1027938

#TimeUsernameProblemLanguageResultExecution timeMemory
1027938mansurTiles (BOI24_tiles)C++17
15 / 100
39 ms3160 KiB
#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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...