记录编号 |
129761 |
评测结果 |
AAAAAAAAAA |
题目名称 |
[NOIP 2011]铺地毯 |
最终得分 |
100 |
用户昵称 |
Asm.Def |
是否通过 |
通过 |
代码语言 |
C++ |
运行时间 |
0.016 s |
提交时间 |
2014-10-20 21:09:15 |
内存使用 |
0.37 MiB |
显示代码纯文本
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cmath>
#include <cctype>
#include <queue>
using namespace std;
#if defined DEBUG
FILE *in = fopen("test","r");
#define out stdout
#else
FILE *in = fopen("carpet.in","r");
FILE *out = fopen("carpet.out","w");
#endif
inline void getint(int &x){
int c = fgetc(in);
while(!isdigit(c))c = fgetc(in);
x = c - '0';
while(isdigit(c = fgetc(in)))x = x * 10 - '0' + c;
}
/*==================================================*/
const int maxn = 10000 + 3;
int n, a[maxn], b[maxn], c[maxn], d[maxn], x, y;
inline bool ok(int i){
int j = x - a[i], k = y - b[i];
if(j < 0 || k < 0)return 0;
if(j > c[i] || k > d[i])return 0;
return 1;
}
int main(){
getint(n);
int ans = -1;
for(int i = 1;i <= n;++i)
getint(a[i]),getint(b[i]),getint(c[i]),getint(d[i]);
getint(x), getint(y);
for(int i = 1;i <= n;++i)
if(ok(i))ans = i;
fprintf(out, "%d\n", ans);
return 0;
}