30分 set TLE 了
查看原帖
30分 set TLE 了
1068513
ZHUSITAOcccccc楼主2024/11/24 11:10
#include <bits/stdc++.h>
using namespace std;
long long n, a, ans, hand;
set<long long> s;
int main() {
	cin >> n;	
	for (long long i = 1; i <= n; i++) {
		hand = 0;
		cin >> a;
		s.insert(a);
			for (auto x : s) {
				if (x == a)
					break;
				hand++;
			}
			ans += hand;	
	}
	cout << ans;
	return 0;
} 
2024/11/24 11:10
加载中...