记录编号 129315 评测结果 AAAAAAAAAA
题目名称 [NOIP 2011]铺地毯 最终得分 100
用户昵称 Gravatar→震世逆空波→ 是否通过 通过
代码语言 C++ 运行时间 0.016 s
提交时间 2014-10-19 19:32:07 内存使用 0.44 MiB
显示代码纯文本
  1. #include <cstdio>
  2. using namespace std;
  3. class Floor
  4. {
  5. public:
  6. int a,b,g,k;
  7. }s[10001];
  8. int n,x,y;
  9. bool Find(int x0,int y0,int lx,int ly,int x1,int y1)
  10. {
  11. if(((x1>=x0)&&(x1<=x0+lx))&&(y1>=y0)&&(y1<=y0+ly))
  12. {
  13. return true;
  14. }
  15. else return false;
  16. }
  17. int main()
  18. {
  19. freopen("carpet.in","r",stdin);
  20. freopen("carpet.out","w",stdout);
  21. scanf("%d",&n);
  22. for(int i=1;i<=n;i++)
  23. {
  24. scanf("%d%d%d%d",&s[i].a,&s[i].b,&s[i].g,&s[i].k);
  25. }
  26. scanf("%d%d",&x,&y);
  27. int ans=0;
  28. for(int i=n;i>=1;i--)
  29. {
  30. if(Find(s[i].a,s[i].b,s[i].g,s[i].k,x,y)==true)
  31. {
  32. ans=i;
  33. printf("%d\n",ans);
  34. return 0;
  35. }
  36. }
  37. if(ans==0) printf("-1\n");
  38. return 0;
  39. }