# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
673258 | 2022-12-20T03:54:16 Z | Alihan_8 | Hedgehog Daniyar and Algorithms (IZhO19_sortbooks) | C++17 | 3000 ms | 24112 KB |
#include <bits/stdc++.h> // include <ext/pb_ds/assoc_container.hpp> // include <ext/pb_ds/tree_policy.hpp> // using namespace __gnu_pbds; using namespace std; #define all(x) x.begin(), x.end() #define pb push_back // define ordered_set tree<int,null_type,less_equal<int>,rb_tree_tag,tree_order_statistics_node_update> #define mpr make_pair #define ln '\n' void IO(string name){freopen((name+".in").c_str(),"r",stdin); freopen((name+".out").c_str(),"w",stdout);} #define int long long signed main(){ ios_base::sync_with_stdio(false); cin.tie(NULL); int n, m; cin >> n >> m; vector <int> p(n); for ( auto &i: p ) cin >> i; auto ok = [&](int l, int r, int k){ vector <int> _list; --l, --r; for ( int i = l; i <= r; i++ ) _list.pb(p[i]); multiset <int> st; for ( auto i: _list ){ if ( st.empty() ){ st.insert(i); continue; } if ( *st.rbegin() <= i ); else if ( *st.rbegin()+i > k ) return false; st.insert(i); } return true; }; while ( m-- ){ int l, r, k; cin >> l >> r >> k; cout << ok(l, r, k) << ln; } cout << '\n'; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 0 ms | 212 KB | Output is correct |
3 | Correct | 1 ms | 212 KB | Output is correct |
4 | Correct | 1 ms | 212 KB | Output is correct |
5 | Correct | 1 ms | 212 KB | Output is correct |
6 | Correct | 1 ms | 340 KB | Output is correct |
7 | Correct | 2 ms | 340 KB | Output is correct |
8 | Correct | 11 ms | 340 KB | Output is correct |
9 | Correct | 6 ms | 212 KB | Output is correct |
10 | Correct | 8 ms | 340 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 0 ms | 212 KB | Output is correct |
3 | Correct | 1 ms | 212 KB | Output is correct |
4 | Correct | 1 ms | 212 KB | Output is correct |
5 | Correct | 1 ms | 212 KB | Output is correct |
6 | Correct | 1 ms | 340 KB | Output is correct |
7 | Correct | 2 ms | 340 KB | Output is correct |
8 | Correct | 11 ms | 340 KB | Output is correct |
9 | Correct | 6 ms | 212 KB | Output is correct |
10 | Correct | 8 ms | 340 KB | Output is correct |
11 | Correct | 7 ms | 340 KB | Output is correct |
12 | Correct | 14 ms | 524 KB | Output is correct |
13 | Correct | 16 ms | 588 KB | Output is correct |
14 | Correct | 29 ms | 668 KB | Output is correct |
15 | Correct | 23 ms | 596 KB | Output is correct |
16 | Correct | 1114 ms | 876 KB | Output is correct |
17 | Correct | 1111 ms | 648 KB | Output is correct |
18 | Correct | 936 ms | 660 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Execution timed out | 3061 ms | 24112 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Execution timed out | 3043 ms | 6440 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 0 ms | 212 KB | Output is correct |
3 | Correct | 1 ms | 212 KB | Output is correct |
4 | Correct | 1 ms | 212 KB | Output is correct |
5 | Correct | 1 ms | 212 KB | Output is correct |
6 | Correct | 1 ms | 340 KB | Output is correct |
7 | Correct | 2 ms | 340 KB | Output is correct |
8 | Correct | 11 ms | 340 KB | Output is correct |
9 | Correct | 6 ms | 212 KB | Output is correct |
10 | Correct | 8 ms | 340 KB | Output is correct |
11 | Correct | 7 ms | 340 KB | Output is correct |
12 | Correct | 14 ms | 524 KB | Output is correct |
13 | Correct | 16 ms | 588 KB | Output is correct |
14 | Correct | 29 ms | 668 KB | Output is correct |
15 | Correct | 23 ms | 596 KB | Output is correct |
16 | Correct | 1114 ms | 876 KB | Output is correct |
17 | Correct | 1111 ms | 648 KB | Output is correct |
18 | Correct | 936 ms | 660 KB | Output is correct |
19 | Execution timed out | 3061 ms | 14980 KB | Time limit exceeded |
20 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 0 ms | 212 KB | Output is correct |
3 | Correct | 1 ms | 212 KB | Output is correct |
4 | Correct | 1 ms | 212 KB | Output is correct |
5 | Correct | 1 ms | 212 KB | Output is correct |
6 | Correct | 1 ms | 340 KB | Output is correct |
7 | Correct | 2 ms | 340 KB | Output is correct |
8 | Correct | 11 ms | 340 KB | Output is correct |
9 | Correct | 6 ms | 212 KB | Output is correct |
10 | Correct | 8 ms | 340 KB | Output is correct |
11 | Correct | 7 ms | 340 KB | Output is correct |
12 | Correct | 14 ms | 524 KB | Output is correct |
13 | Correct | 16 ms | 588 KB | Output is correct |
14 | Correct | 29 ms | 668 KB | Output is correct |
15 | Correct | 23 ms | 596 KB | Output is correct |
16 | Correct | 1114 ms | 876 KB | Output is correct |
17 | Correct | 1111 ms | 648 KB | Output is correct |
18 | Correct | 936 ms | 660 KB | Output is correct |
19 | Execution timed out | 3061 ms | 24112 KB | Time limit exceeded |
20 | Halted | 0 ms | 0 KB | - |