Submission #977115

# Submission time Handle Problem Language Result Execution time Memory
977115 2024-05-07T11:56:05 Z Isam Money (IZhO17_money) C++17
0 / 100
0 ms 348 KB
#include<bits/stdc++.h>
using namespace std;

constexpr int sz = 1e6 + 6;

int n, a[sz], ans;

set<int> st;

int makni = 1E9;

signed main(){
	ios_base::sync_with_stdio(0), cin.tie(0);
	cin >> n;
	for(register int i = 1; i <= n; ++i){
		cin >> a[i];
	}
		
	for(register int i = 1; i <= n; ++i){
		
		if(a[i] < a[i-1] || makni < a[i]){
			++ans;	
			if(!st.empty()) makni = *st.begin();
		}
		
		st.insert(a[i]);
	}	
	
	cout << ans << '\n';
	
}

Compilation message

money.cpp: In function 'int main()':
money.cpp:15:19: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   15 |  for(register int i = 1; i <= n; ++i){
      |                   ^
money.cpp:19:19: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   19 |  for(register int i = 1; i <= n; ++i){
      |                   ^
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Incorrect 0 ms 348 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Incorrect 0 ms 348 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Incorrect 0 ms 348 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Incorrect 0 ms 348 KB Output isn't correct
3 Halted 0 ms 0 KB -