本人已疯
查看原帖
本人已疯
762086
Francium_楼主2024/6/1 17:03
#include <bits/stdc++.h>
using namespace std;
stack<pair<unsigned long long, int>> sta;
int n;unsigned long long ans;

int main() {
	cin >> n;
	for (int i = 1; i <= n; i++) {
		long long x;
		cin >> x;
		while (!sta.empty() && sta.top().first <= x) {
			ans ^= sta.top().second;
			sta.pop();
		}
		sta.push({x, i});
		ans ^= sta.top().second;
		cout << ans << '\n';
	}
	return 0;
}

这代码一直在#1TLE与#2WA之间反复横跳。。。

2024/6/1 17:03
加载中...