# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
673253 | 2022-12-20T03:40:02 Z | Alihan_8 | Hedgehog Daniyar and Algorithms (IZhO19_sortbooks) | C++17 | 3000 ms | 30768 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> sorted, _list; --l, --r; for ( int i = l; i <= r; i++ ) sorted.pb(p[i]), _list.pb(p[i]); sort(all(sorted)); for ( int i = 0; i < (int)_list.size(); i++ ){ for ( int j = 0; j+1 < (int)_list.size(); j++ ){ if ( _list[j] > _list[j+1] and _list[j]+_list[j+1] <= k ) swap(_list[j], _list[j+1]); } } return sorted == _list; }; 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 | 1 ms | 212 KB | Output is correct |
3 | Correct | 5 ms | 340 KB | Output is correct |
4 | Correct | 2 ms | 212 KB | Output is correct |
5 | Correct | 2 ms | 212 KB | Output is correct |
6 | Correct | 51 ms | 340 KB | Output is correct |
7 | Correct | 49 ms | 328 KB | Output is correct |
8 | Correct | 86 ms | 340 KB | Output is correct |
9 | Correct | 22 ms | 328 KB | Output is correct |
10 | Correct | 59 ms | 340 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 1 ms | 212 KB | Output is correct |
3 | Correct | 5 ms | 340 KB | Output is correct |
4 | Correct | 2 ms | 212 KB | Output is correct |
5 | Correct | 2 ms | 212 KB | Output is correct |
6 | Correct | 51 ms | 340 KB | Output is correct |
7 | Correct | 49 ms | 328 KB | Output is correct |
8 | Correct | 86 ms | 340 KB | Output is correct |
9 | Correct | 22 ms | 328 KB | Output is correct |
10 | Correct | 59 ms | 340 KB | Output is correct |
11 | Correct | 2520 ms | 444 KB | Output is correct |
12 | Execution timed out | 3061 ms | 568 KB | Time limit exceeded |
13 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Execution timed out | 3031 ms | 30768 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Execution timed out | 3026 ms | 2760 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 1 ms | 212 KB | Output is correct |
3 | Correct | 5 ms | 340 KB | Output is correct |
4 | Correct | 2 ms | 212 KB | Output is correct |
5 | Correct | 2 ms | 212 KB | Output is correct |
6 | Correct | 51 ms | 340 KB | Output is correct |
7 | Correct | 49 ms | 328 KB | Output is correct |
8 | Correct | 86 ms | 340 KB | Output is correct |
9 | Correct | 22 ms | 328 KB | Output is correct |
10 | Correct | 59 ms | 340 KB | Output is correct |
11 | Correct | 2520 ms | 444 KB | Output is correct |
12 | Execution timed out | 3061 ms | 568 KB | Time limit exceeded |
13 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 1 ms | 212 KB | Output is correct |
3 | Correct | 5 ms | 340 KB | Output is correct |
4 | Correct | 2 ms | 212 KB | Output is correct |
5 | Correct | 2 ms | 212 KB | Output is correct |
6 | Correct | 51 ms | 340 KB | Output is correct |
7 | Correct | 49 ms | 328 KB | Output is correct |
8 | Correct | 86 ms | 340 KB | Output is correct |
9 | Correct | 22 ms | 328 KB | Output is correct |
10 | Correct | 59 ms | 340 KB | Output is correct |
11 | Correct | 2520 ms | 444 KB | Output is correct |
12 | Execution timed out | 3061 ms | 568 KB | Time limit exceeded |
13 | Halted | 0 ms | 0 KB | - |