제출 #1027949

#제출 시각아이디문제언어결과실행 시간메모리
1027949mansurTiles (BOI24_tiles)C++17
4 / 100
36 ms2248 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; vector<int> x = {-1}, y = {-1}; for (int i = 1; i <= n; i++) { int a, b; cin >> a >> b; if (sz(x) > 2) { if (x[sz(x) - 2] == x[sz(x) - 1] && x[sz(x) - 1] == a) x.pop_back(); else if (y[sz(y) - 2] == y[sz(y) - 1] && y[sz(y) - 1] == b) y.pop_back(); } x.push_back(a); y.push_back(b); } if (sz(x) > 4) { if (x.back() == x[0] && x.back() == x[sz(x) - 2]) x.pop_back(); else if (y.back() == y[0] && y.back() == y[sz(y) - 2]) y.pop_back(); } n = sz(x) - 1; if (n & 1) cout << 5 / 0; if (n <= 4) { sort(all(y)); if ((y[n] - y[1]) & 1) cout << 0 << ' '; else cout << m - (m & 1); return; } for (int i = 1; i <= n; i++) { 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(); }

컴파일 시 표준 에러 (stderr) 메시지

Main.cpp: In function 'void solve()':
Main.cpp:37:23: warning: division by zero [-Wdiv-by-zero]
   37 |  if (n & 1) cout << 5 / 0;
      |                     ~~^~~
#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...