結果
問題 | No.3137 Non-Intersect Chord Triangle Game |
ユーザー |
|
提出日時 | 2025-05-02 22:11:13 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 65 ms / 2,000 ms |
コード長 | 875 bytes |
コンパイル時間 | 2,409 ms |
コンパイル使用メモリ | 201,008 KB |
実行使用メモリ | 7,680 KB |
最終ジャッジ日時 | 2025-05-02 22:11:20 |
合計ジャッジ時間 | 6,146 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 65 |
ソースコード
#include <bits/stdc++.h> using namespace std; int main(){ ios_base::sync_with_stdio(false); cin.tie(nullptr); int N,M; cin >> N >> M; vector<int> NG(N,-1); for(int i=0; i<M; i++){ int p,q; cin >> p >> q; p--; q--; NG.at(p) = i,NG.at(q) = i; } int win = 0; vector<bool> already(M); stack<int> St; St.push(0); for(int i=0; i<N; i++){ if(NG.at(i) == -1){ int &a = St.top(); a++; } else{ int pos = NG.at(i); if(already.at(pos)){ int a = St.top(); if(a%4 == 2) win = 1; St.pop(); } else{ already.at(pos) = true; St.push(0); } } } if(St.top()%4 == 2) win = 1; if(win) cout << "Akane" << endl; else cout << "Aoi" << endl; }