// Problem: A - Hedgehog Daniyar and Algorithms
// Contest: Virtual Judge - IOI contest #3 (div 1 + 2)
// URL: https://vjudge.net/contest/610287#problem/A
// Memory Limit: 256 MB
// Time Limit: 3000 ms
//
// Powered by CP Editor (https://cpeditor.org)
#include <bits/stdc++.h>
#define noSuccess t--
#define int long long
#define pb push_back
#define pf push_front
#define F first
#define S second
#define highspeed ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define all(s) s.begin(),s.end()
#define sr(a) sort(a+1,a+1+n);reverse(a+1,a+1+n)
#define s(a) sort(a+1,a+1+n)
#define in insert
#define upb upper_bound
#define issrt is_sorted(a+1,a+1+n)
#define yes "YES\n"
#define no "NO\n"
#define sz size
#define pii pair<int,int>
using namespace std;
const int maxn = 1e6;
void tryAgain(){
int n,m;
cin>>n>>m;
int a[n+5];
for(int i=1;i<=n;i++){
cin>>a[i];
}
while(m--){
int l,r,v;
cin>>l>>r>>v;
bool ok=true;
for(int i=l;i<=r;i++){
int cal=0;
for(int j=l;j<=r;j++){
if(i==j) continue;
if(a[i]+a[j]<=v) cal++;;
}
if(!cal){
ok=false;
break;
}
}
cout<<ok<<'\n';
}
}
signed main(){
// freopen("something", "r", stdin);
// freopen("something", "w", stdout);
highspeed
int t = 1;
//cin >> t;
while(noSuccess){
tryAgain();
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Incorrect |
0 ms |
500 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Incorrect |
0 ms |
500 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
3057 ms |
8276 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
3070 ms |
1116 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Incorrect |
0 ms |
500 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Incorrect |
0 ms |
500 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |