답안 #498017

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
498017 2021-12-24T09:18:37 Z Aktan Money (IZhO17_money) C++17
0 / 100
0 ms 204 KB
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
#define int long long
#define ft first
#define sc second
using namespace std;
const int mod=1e9+7,INF=1e17;
set<int> m;
main(){
   int n,ans=0;
   cin >> n;
   vector<int> a(n);
   m.insert(0);
   m.insert(INF);
   for(int i=0;i<n;i++){
   	cin >> a[i];
   }  
   
   
   for(int i=0;i<n;i++){
   	ans++;
   	auto it=m.upper_bound(a[i]);
   	m.insert(a[i]);
   	int res=*it;
   	while(a[i]<=a[i+1] && a[i+1]<=res && i<n-1){
   		m.insert(a[i]);
   		i++;
	   }
   }
   cout << ans;
   
}

Compilation message

money.cpp:12:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   12 | main(){
      | ^~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 204 KB Output is correct
2 Incorrect 0 ms 204 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 204 KB Output is correct
2 Incorrect 0 ms 204 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 204 KB Output is correct
2 Incorrect 0 ms 204 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 204 KB Output is correct
2 Incorrect 0 ms 204 KB Output isn't correct
3 Halted 0 ms 0 KB -