제출 #92497

#제출 시각아이디문제언어결과실행 시간메모리
92497RandooomMoney (IZhO17_money)C++14
45 / 100
13 ms2296 KiB
#include <bits/stdc++.h> #define in freopen ("input.txt", "r", stdin); #define out freopen("output.txt", "w", stdout); #define ll long long int const int val = (1e5) + 5; const int inf = (1e9) + 7; double eps = 0.000000001; using namespace std; int a[val], ans = 1; set <int> q; set <int> :: iterator l, r; int solve(){ int n; cin >> n; for(int i=1; i<=n; ++i){ cin >> a[i]; } q.insert(0); q.insert(inf); l = q.lower_bound(a[1]); r = q.upper_bound(a[1]); -- l; q.insert(a[1]); for(int i=2; i<=n; ++i){ if(a[i] >= a[i-1] && *l <= a[i] && a[i] <= *r){ q.insert(a[i]); } else{ l = q.lower_bound(a[i]); r = q.upper_bound(a[i]); -- l; q.insert(a[i]); ++ ans; } } cout << ans << endl; } int main(){ //in out ios_base::sync_with_stdio(0); solve(); return 0; }

컴파일 시 표준 에러 (stderr) 메시지

money.cpp: In function 'int solve()':
money.cpp:41:1: warning: no return statement in function returning non-void [-Wreturn-type]
 }
 ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...