Submission #927938

# Submission time Handle Problem Language Result Execution time Memory
927938 2024-02-15T14:14:12 Z Isam Baloni (COCI15_baloni) C++17
100 / 100
176 ms 7508 KB
#include<bits/stdc++.h>

/*

......

*/

using namespace std;

constexpr int sz = 2e5 + 5;

int n;
map<int, int> mp;

int main(){
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	cin >> n;
	vector<int> h(n);
	for(auto &j : h) cin >> j;
	for(register int i = n - 1; i >= 0; --i){
		if(mp[h[i] - 1]){
			mp[h[i] - 1]--;
		}
		mp[h[i]]++;
	}
	int ans(0);
	for(auto &it : mp) ans += it.second;
	cout << ans << '\n';
	return 0;
}
/*


*/

Compilation message

baloni.cpp: In function 'int main()':
baloni.cpp:21:19: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   21 |  for(register int i = n - 1; i >= 0; --i){
      |                   ^
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 176 ms 7248 KB Output is correct
6 Correct 173 ms 7508 KB Output is correct
7 Correct 142 ms 5968 KB Output is correct
8 Correct 136 ms 5960 KB Output is correct
9 Correct 163 ms 6708 KB Output is correct
10 Correct 156 ms 6736 KB Output is correct