# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
203281 | Rakhmand | Two Antennas (JOI19_antennas) | C++14 | 3066 ms | 2424 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
//
// ROIGold.cpp
// Main calisma
//
// Created by Rakhman on 05/02/2019.
// Copyright © 2019 Rakhman. All rights reserved.
//
#include <cstring>
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <queue>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cassert>
#include <iterator>
#define ios ios_base::sync_with_stdio(0), cout.tie(0), cin.tie(0);
#define S second
#define F first
#define pb push_back
#define nl '\n'
#define NL cout << '\n';
#define EX exit(0)
#define all(s) s.begin(), s.end()
#define FOR(i, start, finish, k) for(int i = start; i <= finish; i += k)
const int MXN = 2e5 + 1;
const long long MNN = 1e6 + 200;
const long long MOD = 1e9 + 7;
const long long INF = 1e18;
const int OO = 1e9 + 500;
typedef long long llong;
typedef unsigned long long ullong;
using namespace std;
void istxt(bool yes){
if(yes == 1){
freopen("balancing.in", "r", stdin);
//freopen("/Users/rakhmanabdirashov/Desktop/folder/Programming/Road2Master/Road2Master/e.txt", "w", stdout);
}else{
freopen("/Users/rakhmanabdirashov/Desktop/folder/Programming/Road2Master/Road2Master/input.txt", "r", stdin);
}
}
int n;
struct antenna{
int h, a, b;
}b[MXN];
bool intersect(antenna a, antenna b){
if(a.a <= b.a && b.a <= a.b){
return true;
}
if(b.a <= a.a && a.a <= b.b){
return true;
}
return false;
}
int main () {
ios;
//istxt(0);
cin >> n;
for(int i = 1; i <= n; i++){
cin >> b[i].h >> b[i].a >> b[i].b;
}
int q;
cin >> q;
while(q--){
int l, r;
cin >> l >> r;
int ans = -1;
for(int i = l; i <= r; i++){
for(int j = i + 1; j <= r; j++){
if(intersect(b[i], b[j])){
ans = max(ans, abs(b[i].h - b[j].h));
}
}
}
cout << ans << nl;
}
return 0;
}
Compilation message (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... |