Submission #1153834

#TimeUsernameProblemLanguageResultExecution timeMemory
1153834pearl333Po (COCI21_po)C++20
50 / 70
1096 ms5700 KiB
#include <bits/stdc++.h>
using namespace std;
#define int long long

int n;
set<int> s;
int ans = 0;
bool first = false;

signed main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cin>>n;
	int arr[n];
	for (int i = 0; i<n;i++) {
		int t;
		cin>>t;
		arr[i]=t;
		s.insert(t);
	}
	for (auto &a: s) {
		first = false;
		for (int i = 0;i<n;i++) {
			if (a!=0) {
				if (arr[i]==a) {
					first = true;
				}
				if (first and arr[i]<a) {
					ans+=1;
					first = false;
				}
			}
		}
		if (first) {
			ans+=1;
		}
	}
	cout<<ans;
	return 0;
}
#Verdict Execution timeMemoryGrader output
Fetching results...