# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1183820 | asdfghjk | Hedgehog Daniyar and Algorithms (IZhO19_sortbooks) | C++20 | 3095 ms | 8328 KiB |
#include <bits/stdc++.h>
#define pb push_back
#define all(x) x.begin(), x.end()
#define F first
#define S second
#define con continue
using namespace std;
typedef long long ll;
typedef double db;
typedef long double ld;
const ll N = 1e6 + 5;
const ll inf = 1e9;
const ll INF = 1e18;
const ll MOD = 1e9 + 7;
int a[N],b[N],c[N];
void solve(){
int n,m;cin >> n >> m;
for(int i= 1;i <= n;i++){
cin >> a[i];
}
while(m--){
int l,r,k;cin >> l >> r >> k;
int d = (r - l + 1);
for(int i = 1;i <= d;i++){
b[i] = a[l + (i - 1)];
c[i] = a[l + (i - 1)];
}
int mx = 0;
for(int i = d-1;i > 0;i--){
int j = i;
while(b[j] > b[j+1] && j < d){
mx = max(mx,(b[j] + b[j+1]));
swap(b[j],b[j+1]);
j++;
}
}
if(mx > k){
cout << "0\n";
}
else cout << "1\n";
}
}
main(){
ios_base::sync_with_stdio(0);
cin.tie(0);
int t = 1;
//cin >> t;
while(t--){
solve();
}
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |