結果

問題 No.3137 Non-Intersect Chord Triangle Game
ユーザー Cafe1942
提出日時 2025-05-01 20:38:58
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 172 ms / 2,000 ms
コード長 646 bytes
コンパイル時間 974 ms
コンパイル使用メモリ 74,284 KB
実行使用メモリ 11,776 KB
最終ジャッジ日時 2025-05-01 20:39:06
合計ジャッジ時間 6,857 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 65
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <stack>
using namespace std;
int main() {
	int N;
	cin >> N;
	int M;
	cin >> M;
	int count[1000001] = { 0 };
	int point[1000001] = { 0 };
	stack<int>S;
	for (int i = 1;i <= M;i++) {
		int P, Q;
		cin >> P >> Q;
		if (P > Q) {//P<Qとしておきたい
			swap(P, Q);
		}
		point[P] = Q;
		point[Q] = P;
	}
	S.push(0);//番兵
	for (int i = 1;i <= N;i++) {
		if (point[i] == 0) {
			count[S.top()]++;
			continue;
		}
		else if (i < point[i]) {
			S.push(i);
		}
		else {
			S.pop();
		}
	}
	for (int i = 0;i <= N;i++) {
		if (count[i] % 4 == 2) {
			cout << "Akane\n";
			return 0;
		}
	}
	cout << "Aoi";
	return 0;
}
0