Codeforces Round \ # 313 (Div. 2) B. Gerald is into Art 물 문제
6922 단어 codeforces
Time Limit: 20 Sec
Memory Limit: 256 MB
제목 연결
http://codeforces.com/contest/560/problem/B
Description
Gerald bought two very rare paintings at the Sotheby's auction and he now wants to hang them on the wall. For that he bought a special board to attach it to the wall and place the paintings on the board. The board has shape of an a1 × b1 rectangle, the paintings have shape of a a2 × b2 and a3 × b3 rectangles.
Since the paintings are painted in the style of abstract art, it does not matter exactly how they will be rotated, but still, one side of both the board, and each of the paintings must be parallel to the floor. The paintings can touch each other and the edges of the board, but can not overlap or go beyond the edge of the board. Gerald asks whether it is possible to place the paintings on the board, or is the board he bought not large enough?
Input
The first line contains two space-separated numbers a1 and b1 — the sides of the board. Next two lines contain numbers a2, b2, a3 andb3 — the sides of the paintings. All numbers ai, bi in the input are integers and fit into the range from 1 to 1000.
Output
If the paintings can be placed on the wall, print "YES" (without the quotes), and if they cannot, print "NO" (without the quotes).
Sample Input
3 21 32 1
Sample Output
YES
HINT
제목
n * m 의 사각형 을 드 리 겠 습 니 다. 동료 에 게 n1 * m1 과 n2 * m2 의 사각형 을 놓 을 수 있 느 냐 고 물 었 습 니 다.
문제 풀이:
판단 만...
하 다
코드 보 세 요.
코드
#include <cstdio>
#include <cmath>
#include <cstring>
#include <ctime>
#include <iostream>
#include <algorithm>
#include <set>
#include <vector>
#include <sstream>
#include <queue>
#include <typeinfo>
#include <fstream>
#include <map>
#include <stack>
typedef long long ll;
using namespace std;
//freopen("D.in","r",stdin);
//freopen("D.out","w",stdout);
#define sspeed ios_base::sync_with_stdio(0);cin.tie(0)
#define test freopen("test.txt","r",stdin)
const int maxn=202501;
#define mod 1000000007
#define eps 1e-9
const int inf=0x3f3f3f3f;
const ll infll = 0x3f3f3f3f3f3f3f3fLL;
inline ll read()
{
ll x=0,f=1;char ch=getchar();
while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
return x*f;
}
//**************************************************************************************
int a1,b1,a2,b2,a3,b3;
int main(){
cin>>a1>>b1>>a2>>b2>>a3>>b3;
if (max(a2,a3)<=a1&&b2+b3<=b1||
max(a2,a3)<=b1&&b2+b3<=a1||
max(a2,b3)<=a1&&b2+a3<=b1||
max(a2,b3)<=b1&&b2+a3<=a1||
max(b2,a3)<=a1&&a2+b3<=b1||
max(b2,a3)<=b1&&a2+b3<=a1||
max(b2,b3)<=a1&&a2+a3<=b1||
max(b2,b3)<=b1&&a2+a3<=a1) cout << "YES
";
else cout << "NO
";
}
이 내용에 흥미가 있습니까?
현재 기사가 여러분의 문제를 해결하지 못하는 경우 AI 엔진은 머신러닝 분석(스마트 모델이 방금 만들어져 부정확한 경우가 있을 수 있음)을 통해 가장 유사한 기사를 추천합니다:
Codeforces Round #715 Div. 2C The Sports Festival: 구간 DP전형구간 DP의 초전형. 이하, 0-indexed. 입력을 정렬하여 어디서나 시작하고 최적으로 좌우로 계속 유지하면 좋다는 것을 알 수 있습니다. {2000})$의 주문이 된다. 우선, 입력을 소트하여 n개의 요소를 $...
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
CC BY-SA 2.5, CC BY-SA 3.0 및 CC BY-SA 4.0에 따라 라이센스가 부여됩니다.