답안 #372994

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
372994 2021-03-02T23:54:47 Z sam571128 Po (COCI21_po) C++14
30 / 70
30 ms 5612 KB
#include <bits/stdc++.h>

#define int long long
#define fastio ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

using namespace std;

signed main(){
	fastio
	int n;
	cin >> n;
	int arr[n], mn = 1e18;
	for(auto &x : arr){
		cin >> x;
		mn = min(x,mn);
	}
	for(auto &x : arr) x -= mn;
	
	int ans = (mn!=0);
	set<int> s;
	for(int i = 0;i < n;i++){
		if(arr[i]==0){
			ans += s.size();
			s.clear();
		}else{
			s.insert(arr[i]);
		}
	}
	ans += s.size();
	cout << ans << "\n";
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 364 KB Output is correct
2 Incorrect 1 ms 364 KB Output isn't correct
3 Incorrect 1 ms 384 KB Output isn't correct
4 Incorrect 7 ms 876 KB Output isn't correct
5 Incorrect 10 ms 1260 KB Output isn't correct
6 Correct 24 ms 4460 KB Output is correct
7 Correct 30 ms 5612 KB Output is correct