# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
632586 | Mahdi | Jail (JOI22_jail) | C++17 | 1 ms | 212 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.
#include<bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;
#define all(v) v.begin(), v.end()
#define F first
#define S second
typedef pair<int, int> pii;
typedef long long ll;
int n, m;
void sol(){
cin>>n;
for(int i=1;i<n;++i){
int u, v;
cin>>u>>v;
if(u!=i && v!=u+1){
cout<<1/0;
}
}
cin>>m;
if(m!=2)
cout<<1/0;
int a, b, u, v;
cin>>a>>b>>u>>v;
if(a<b){
if(u<v){
ll x=1LL*(u-a)*(v-b);
if(x>0)
cout<<"YES\n";
else
cout<<"NO\n";
}
else{
if(v>b || u<a)
cout<<"YES\n";
else
cout<<"NO\n";
}
}
else{
if(u>v){
ll x=1LL*(u-a)*(v-b);
if(x>0)
cout<<"YES\n";
else
cout<<"NO\n";
}
else{
if(u>a || v<b)
cout<<"YES\n";
else
cout<<"NO\n";
}
}
}
int main(){
ios_base::sync_with_stdio(0); cin.tie(0);
int T;
cin>>T;
while(T--)
sol();
}
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... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |