結果
問題 |
No.3137 Non-Intersect Chord Triangle Game
|
ユーザー |
|
提出日時 | 2025-05-04 18:28:51 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 61 ms / 2,000 ms |
コード長 | 832 bytes |
コンパイル時間 | 2,220 ms |
コンパイル使用メモリ | 205,076 KB |
実行使用メモリ | 7,844 KB |
最終ジャッジ日時 | 2025-05-04 18:28:57 |
合計ジャッジ時間 | 6,079 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 65 |
ソースコード
#include <bits/stdc++.h> using namespace std; int main(){ ios::sync_with_stdio(false); cin.tie(0); int n, m, l, r; cin >> n >> m; vector<pair<int,int>> seg(m); for(auto &&[r, l] : seg){ cin >> r >> l; if(r < l) swap(r, l); } sort(seg.begin(), seg.end()); stack<pair<int,int>> stk; for(auto &&[r, l] : seg){ int tot = r - l - 1; while(!stk.empty() && l < stk.top().first){ auto [l2, r2] = stk.top(); stk.pop(); tot -= r2 - l2 + 1; } if((tot & 3) == 2){ cout << "Akane\n"; exit(0); } stk.emplace(l, r); } while(!stk.empty()){ tie(l, r) = stk.top(); stk.pop(); n -= r - l + 1; } cout << ((n & 3) == 2 ? "Akane" : "Aoi") << '\n'; }