# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
339048 | Khizri | Hedgehog Daniyar and Algorithms (IZhO19_sortbooks) | C++17 | 3067 ms | 33776 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <cstdio>
#include <algorithm>
#include <set>
using namespace std;
//------------------------------------------------------------------------------
//******************************************************************************
#define IOS ios_base::sync_with_stdio(false); cin.tie(0),cout.tie(0)
#define pb push_back
#define F first
#define S second
#define INF 1e18
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define ll long long
#define MOD 1e9+7
#define endl '\n'
const int mxn=1e6+5;
//******************************************************************************
//------------------------------------------------------------------------------
ll t=1,n,m,arr[mxn],l,r,k;
bool funk(){
multiset<ll>st;
for(int i=l;i<=r;i++){
st.insert(arr[i]);
}
for(int i=l;i<=r;i++){
st.erase(st.find(arr[i]));
multiset<ll>::iterator it=st.lower_bound(arr[i]);
if(it!=st.begin()){
it--;
if((*it)+arr[i]>k){
return false;
}
}
}
return true;
}
void solve(){
scanf("%lld %lld",&n,&m);
for(int i=1;i<=n;i++){
scanf("%lld",&arr[i]);
}
while(m--){
scanf("%lld %lld %lld",&l,&r,&k);
int q=funk();
printf("%d\n",q);
}
}
int main(){
//IOS;
//cin>>t;
while(t--){
solve();
}
return 0;
}
컴파일 시 표준 에러 (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... |