Submission #883286

#TimeUsernameProblemLanguageResultExecution timeMemory
883286marcidMoney (IZhO17_money)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; const int maxn = 1e6+9; #define int long long set<int> k = {-1e9,1e9}; int ans; signed main() { int n; cin >> n; int a[n]; for (int &i:a) cin >> i; for (int i = 0; i < n;) { ans++; int it = *k.upper_bound(a[i]); k.insert(a[i]); int j = i + 1; for (; a[j-1]<=a[j] && a[j] <= it && j < n; j++) { k.insert(a[j]); } i = j; } cout << ans; }

Compilation message (stderr)

money.cpp:5:23: error: narrowing conversion of '-1.0e+9' from 'double' to 'long long int' [-Wnarrowing]
    5 | set<int> k = {-1e9,1e9}; int ans;
      |                       ^