Submission #1128255

#TimeUsernameProblemLanguageResultExecution timeMemory
1128255_TemirhanMoney (IZhO17_money)C++20
0 / 100
1 ms328 KiB
#include <bits/stdc++.h> using namespace std; #define int long long #define pb push_back #define sz(x) x.size() #define F first #define S second #define nl '\n' void Tima() { #ifndef ONLINE_JUDGE freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout); #endif } const int N = 500 * 500 + 1; const int inf = 1e12; const int mod = 1e9 + 7; signed main() { // Tima(); ios_base::sync_with_stdio(0); cin.tie(0); int n; cin >>n; int a[n + 1]; for( int i = 1; i <= n; ++i ) cin >>a[i]; int ans = 0; multiset< int >s; s.insert( -inf ); s.insert( inf ); for( int l = 1; l <= n; ) { ++ans; int r = l; auto j = s.lower_bound( a[l] ); while( r < n && a[r] <= a[r + 1] && s.lower_bound(a[r + 1]) == j ) ++r; for( int _i = l; _i <= r; ++_i ) s.insert( a[_i] ); l = r + 1; } cout <<ans; }

Compilation message (stderr)

money.cpp: In function 'void Tima()':
money.cpp:15:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   15 |     freopen("input.txt", "r", stdin);
      |     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
money.cpp:16:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   16 |     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...