이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#define pb push_back
#define pf push_front
#define ll long long
#define F first
#define S second
#define all(v) (v).begin(),(v).end()
#define ull unsigned long long
#define int long long
#define asdasd ios_base::sync_with_stdio(0);cin.tie(0);
using namespace std;
mt19937 rng( chrono::steady_clock::now().time_since_epoch().count());
long long rand( long long l, long long r )
{
uniform_int_distribution <long long> uid( l, r );
return uid( rng );
}
ll lcm(ll x, ll y){
return x / __gcd(x,y) * y;
}
const int mod = 1e9 + 7;
const ll inf = 1e18;
const int maxn = 1e6 + 6;
int n,m,a[maxn],x[maxn],y[maxn],z[maxn];
void solve(){
cin >> n >> m;
for(int i = 1; i <= n; i++){
cin >> a[i];
}
for(int i = 1; i <= m; i++){
cin >> x[i] >> y[i] >> z[i];
}
if(n <= 5000 && m <= 5000){
for(int i = 1; i <= m; i++){
int l = x[i],r = y[i];
int mx = a[l];
bool ok = 1;
for(int j = l+1; j <= r; j++){
if(mx > a[j] && mx + a[j] > z[i]){
ok = 0;
break;
}
mx = max(mx, a[j]);
}
if(ok){
cout << "1\n";
}
else {
cout << "0\n";
}
}
}
}
signed main(){
asdasd
int tt = 1;
while(tt--){
solve();
}
return 0;
}
# | 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... |