結果

問題 No.3137 Non-Intersect Chord Triangle Game
ユーザー Cafe1942
提出日時 2025-05-01 20:37:43
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
RE  
実行時間 -
コード長 647 bytes
コンパイル時間 1,080 ms
コンパイル使用メモリ 74,284 KB
実行使用メモリ 11,776 KB
最終ジャッジ日時 2025-05-01 20:37:59
合計ジャッジ時間 14,926 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample RE * 3
other AC * 16 RE * 49
権限があれば一括ダウンロードができます

ソースコード

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(-1);//番兵
	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 = 1;i <= N;i++) {
		if (count[i] % 4 == 2) {
			cout << "Akane\n";
			return 0;
		}
	}
	cout << "Aoi";
	return 0;
}
0