problemscpp
A collection of my answers to algorithm problems in c++.
静态 Public 成员函数 | 所有成员列表
luogu::P1003类 参考

洛谷 P1003 [NOIP2011 提高组] 铺地毯 更多...

#include <luogu.h>

静态 Public 成员函数

static int main (istream &cin, ostream &cout)
 

详细描述

洛谷 P1003 [NOIP2011 提高组] 铺地毯

在文件 luogu.h38 行定义.

成员函数说明

◆ main()

int luogu::P1003::main ( istream &  cin,
ostream &  cout 
)
static

在文件 luogu.cpp142 行定义.

142 {
143 auto as = vector<unsigned int>();
144 auto bs = vector<unsigned int>();
145 auto gs = vector<unsigned int>();
146 auto ks = vector<unsigned int>();
147 int n;
148 cin >> n;
149 for(int i = 0; i < n; i++) {
150 unsigned int a;
151 unsigned int b;
152 unsigned int g;
153 unsigned int k;
154 cin >> a >> b >> g >> k;
155 as.push_back(a);
156 bs.push_back(b);
157 gs.push_back(g);
158 ks.push_back(k);
159 }
160 unsigned int x;
161 unsigned int y;
162 cin >> x >> y;
163 for(int i = n - 1; i >= 0; i--) {
164 if(as[i] <= x && x <= as[i] + gs[i] && bs[i] <= y && y <= bs[i] + ks[i]) {
165 cout << i + 1;
166 return 0;
167 }
168 }
169 cout << -1;
170 return 0;
171 }

被这些函数引用 luogu::TEST().


该类的文档由以下文件生成: