Submission #1128722

#TimeUsernameProblemLanguageResultExecution timeMemory
1128722BilAktauAlmansurMoney (IZhO17_money)C++20
0 / 100
0 ms328 KiB
#include <bits/stdc++.h> #pragma optimize("g", on) #pragma GCC optimize ("03") #pragma GCC target ("sse,sse2,sse3,ssse3,sse4,popcnt,abm,avx2,mmx,fma,avx,tune=native") void Freopen () { #ifndef ONLINE_JUDGE freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout); #endif } using namespace std; #define fi first #define se second #define int long long const int N = 1e6 + 7, M = 1e5 + 1, mod = 1e9 + 7; int n, a[N]; void solve() { cin>>n; for(int i = 1; i <= n; i++)cin>>a[i]; multiset<int> st; int ans = 0; st.insert(1e9); for(int i = 1; i <= n;) { auto it = *st.upper_bound(a[i]); st.insert(a[i]); int last = i; for(int j = i + 1; j <= n; j++) { if(a[j] < a[j - 1])break; auto ii = *st.upper_bound(a[j]); if(ii != it)break; st.insert(a[j]); last = j; } // cout << i << ' ' << last << '\n'; i = last + 1, ans ++; } cout << ans << '\n'; } signed main() { // freopen("duty.in", "r", stdin); // freopen("duty.out", "w", stdout); ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); //Freopen(); int T = 1; // cin>>T; while(T --)solve(); }

Compilation message (stderr)

money.cpp: In function 'void Freopen()':
money.cpp:7:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
    7 |     freopen("input.txt", "r", stdin);
      |     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
money.cpp:8:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
    8 |     freopen("output.txt", "w", stdout);
      |     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...