WA on#3求调
查看原帖
WA on#3求调
602372
Brilliant11001楼主2023/8/18 10:56
#include <iostream>

using namespace std;
typedef unsigned long long ll;
const int N = 1000010;
ll stk[N], ans;
int tt, n;
signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	cin >> n;
	for(int i = 1; i <= n; i++) {
		ll x;
		cin >> x;
		if(tt && stk[tt] <= x) ans = i;
		if(!tt || stk[tt] > x) ans ^= i;
		stk[++tt] = x;
		cout << ans << endl;
	}
	return 0;
}

2023/8/18 10:56
加载中...