Submission #535177

#TimeUsernameProblemLanguageResultExecution timeMemory
535177devariaotaMoney (IZhO17_money)C++17
0 / 100
1 ms204 KiB
#include <bits/stdc++.h> #define REP(v, i, j) for (int v = i; v != j; v++) #define FORI(v) for (auto i : v) #define FORJ(v) for (auto j : v) #define OUT(v, a) FORI(v) cout << i << a; #define OUTS(v, a, b) cout << v.size() << a; OUT(v, b) #define in(a, n) REP(i, 0, n) cin >> a[i]; #define SORT(v) sort(begin(v), end(v)) #define REV(v) reverse(begin(v), end(v)) #define pb push_back #define fi first #define se second #define detachIO ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); using namespace std; typedef pair<int, int> pii; typedef pair<pii, int> piii; typedef pair<pii, pii> piiii; set<int> st; vector<int> v; int main() { detachIO; int N; cin >> N; while (N--) { int x; cin >> x; if (st.upper_bound(x) != st.end()) v.pb(*st.upper_bound(x)); else v.pb(1E8); st.insert(x); // cout << v.back() << ' '; } int c = 1E9; int ans = 0; FORI(v) { if (c > i) ans++; c = i; } cout << ans << '\n'; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...