# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
37185 | 2017-12-22T09:53:42 Z | Ulugbek_Abdimanabov | Money (IZhO17_money) | C++14 | 0 ms | 5924 KB |
#include <iostream> #include <cstdio> #include <algorithm> #include <cmath> #include <string> #include <vector> #include <stack> #include <queue> #include <set> #include <cstring> #include <map> #include <cstdlib> #include <ctime> #include <cassert> #include <bitset> #define f first #define s second #define ll long long #define ull unsigned long long #define mp make_pair #define pb push_back #define vi vector <int> #define ld long double #define pii pair<int, int> #define y1 sda using namespace std; const int N = int(1e6) + 10, mod = int(1e9) + 7; int n, a[N]; set <int> st; set <int> :: iterator it; int main () { freopen("money.in","r", stdin); freopen("money.out","w", stdout); scanf("%d",&n); for(int i = 0; i < n; i++){ scanf("%d",&a[i]); } int i = 0, j = 0,mx ; int ans = 0; while(i < n){ j = i; it = st.upper_bound(a[i]); if(it == st.end()){ mx = mod; } else mx = *it; st.insert(a[i]); while(j + 1 < n && a[j + 1] >= a[j] && a[j + 1] <= mx){ j++; st.insert(a[j]); } i = j + 1; ans++; } printf("%d\n", ans); return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 0 ms | 5924 KB | Execution killed because of forbidden syscall [unknown syscall - gap in table] (292) |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 0 ms | 5924 KB | Execution killed because of forbidden syscall [unknown syscall - gap in table] (292) |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 0 ms | 5924 KB | Execution killed because of forbidden syscall [unknown syscall - gap in table] (292) |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 0 ms | 5924 KB | Execution killed because of forbidden syscall [unknown syscall - gap in table] (292) |
2 | Halted | 0 ms | 0 KB | - |