#include "bits/stdc++.h" /** keep-include */
using namespace std;
#define rep(i, b, e) for(int i = (b); i <= (e); i++)
#define per(i, b, e) for(int i = (e); i >= (b); i--)
#define FOR(i, b, e) rep(i, b, (e) - 1)
#define SZ(x) int(x.size())
#define all(x) x.begin(), x.end()
#define pb push_back
#define mp make_pair
#define st first
#define nd second
using ll = long long;
using vi = vector<int>;
using pii = pair<int, int>;
auto &operator<<(auto &o, pair<auto, auto> p) {
return o << "(" << p.st << ", " << p.nd << ")"; }
auto operator<<(auto &o, auto x)->decltype(end(x), o) {
o << "{"; int i=0; for(auto e: x) o << ", " + 2*!i++ << e;
return o << "}"; }
#ifdef LOCAL
#define deb(x...) cerr << "[" #x "]: ", [](auto...$) { \
((cerr << $ << "; "),...) << endl; }(x)
#else
#define deb(...)
#endif
set<pair<int, int> > S[20][20];
void solve() {
int n, m;
cin>>n>>m;
vector<pii> co(n);
for(auto &[x,y]:co){
cin>>x>>y;
}
for(int i=0; i<n; i++){
S[i][i].insert(co[i]);
}
for(int d=1; d<n; d++){
for(int i=0; i+d<n; i++){
for(int j=i; j<i+d; j++){
for(auto &[x, y] : S[i][j]){
for(auto &[x2, y2] : S[j+1][i+d]){
S[i][i+d].insert(mp(min(x, x2), min(y, y2)));
S[i][i+d].insert(mp(max(x, x2), max(y, y2)));
}
}
}
}
}
for(int i=1; i<=m; i++){
int x, y;
cin>>x>>y;
if(S[0][n-1].find(mp(x, y))!=S[0][n-1].end()){
cout<<i<<" ";
}
}
cout<<"\n";
}
int main() {
cin.tie(0)->sync_with_stdio(0);
int tt = 1;
// cin >> tt;
FOR(te, 0, tt) solve();
return 0;
}
Compilation message
Main.cpp:17:18: warning: use of 'auto' in parameter declaration only available with '-fconcepts-ts'
17 | auto &operator<<(auto &o, pair<auto, auto> p) {
| ^~~~
Main.cpp:17:32: warning: use of 'auto' in parameter declaration only available with '-fconcepts-ts'
17 | auto &operator<<(auto &o, pair<auto, auto> p) {
| ^~~~
Main.cpp:17:38: warning: use of 'auto' in parameter declaration only available with '-fconcepts-ts'
17 | auto &operator<<(auto &o, pair<auto, auto> p) {
| ^~~~
Main.cpp:19:17: warning: use of 'auto' in parameter declaration only available with '-fconcepts-ts'
19 | auto operator<<(auto &o, auto x)->decltype(end(x), o) {
| ^~~~
Main.cpp:19:26: warning: use of 'auto' in parameter declaration only available with '-fconcepts-ts'
19 | auto operator<<(auto &o, auto x)->decltype(end(x), o) {
| ^~~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
352 KB |
Output is correct |
5 |
Correct |
0 ms |
352 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
1 ms |
352 KB |
Output is correct |
8 |
Correct |
1 ms |
352 KB |
Output is correct |
9 |
Correct |
0 ms |
360 KB |
Output is correct |
10 |
Correct |
1 ms |
348 KB |
Output is correct |
11 |
Correct |
1 ms |
348 KB |
Output is correct |
12 |
Correct |
1 ms |
348 KB |
Output is correct |
13 |
Correct |
3 ms |
352 KB |
Output is correct |
14 |
Correct |
3 ms |
356 KB |
Output is correct |
15 |
Correct |
6 ms |
616 KB |
Output is correct |
16 |
Correct |
7 ms |
564 KB |
Output is correct |
17 |
Correct |
14 ms |
608 KB |
Output is correct |
18 |
Correct |
16 ms |
720 KB |
Output is correct |
19 |
Correct |
25 ms |
740 KB |
Output is correct |
20 |
Correct |
0 ms |
352 KB |
Output is correct |
21 |
Correct |
1 ms |
352 KB |
Output is correct |
22 |
Correct |
0 ms |
360 KB |
Output is correct |
23 |
Correct |
0 ms |
484 KB |
Output is correct |
24 |
Correct |
0 ms |
360 KB |
Output is correct |
25 |
Correct |
1 ms |
360 KB |
Output is correct |
26 |
Correct |
0 ms |
348 KB |
Output is correct |
27 |
Correct |
6 ms |
616 KB |
Output is correct |
28 |
Correct |
10 ms |
880 KB |
Output is correct |
29 |
Correct |
12 ms |
612 KB |
Output is correct |
30 |
Correct |
26 ms |
612 KB |
Output is correct |
31 |
Correct |
27 ms |
856 KB |
Output is correct |
32 |
Correct |
24 ms |
604 KB |
Output is correct |
33 |
Correct |
46 ms |
860 KB |
Output is correct |
34 |
Correct |
1 ms |
348 KB |
Output is correct |
35 |
Correct |
79 ms |
1008 KB |
Output is correct |
36 |
Correct |
8 ms |
604 KB |
Output is correct |
37 |
Correct |
2 ms |
348 KB |
Output is correct |
38 |
Correct |
1 ms |
348 KB |
Output is correct |
39 |
Correct |
2 ms |
356 KB |
Output is correct |
40 |
Correct |
2 ms |
360 KB |
Output is correct |
41 |
Correct |
2 ms |
360 KB |
Output is correct |
42 |
Correct |
2 ms |
360 KB |
Output is correct |
43 |
Correct |
2 ms |
360 KB |
Output is correct |
44 |
Correct |
2 ms |
360 KB |
Output is correct |
45 |
Correct |
4 ms |
360 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
352 KB |
Output is correct |
5 |
Correct |
0 ms |
352 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
1 ms |
352 KB |
Output is correct |
8 |
Correct |
1 ms |
352 KB |
Output is correct |
9 |
Correct |
0 ms |
360 KB |
Output is correct |
10 |
Correct |
1 ms |
348 KB |
Output is correct |
11 |
Correct |
1 ms |
348 KB |
Output is correct |
12 |
Correct |
1 ms |
348 KB |
Output is correct |
13 |
Correct |
3 ms |
352 KB |
Output is correct |
14 |
Correct |
3 ms |
356 KB |
Output is correct |
15 |
Correct |
6 ms |
616 KB |
Output is correct |
16 |
Correct |
7 ms |
564 KB |
Output is correct |
17 |
Correct |
14 ms |
608 KB |
Output is correct |
18 |
Correct |
16 ms |
720 KB |
Output is correct |
19 |
Correct |
25 ms |
740 KB |
Output is correct |
20 |
Correct |
0 ms |
352 KB |
Output is correct |
21 |
Correct |
1 ms |
352 KB |
Output is correct |
22 |
Correct |
0 ms |
360 KB |
Output is correct |
23 |
Correct |
0 ms |
484 KB |
Output is correct |
24 |
Correct |
0 ms |
360 KB |
Output is correct |
25 |
Correct |
1 ms |
360 KB |
Output is correct |
26 |
Correct |
0 ms |
348 KB |
Output is correct |
27 |
Correct |
6 ms |
616 KB |
Output is correct |
28 |
Correct |
10 ms |
880 KB |
Output is correct |
29 |
Correct |
12 ms |
612 KB |
Output is correct |
30 |
Correct |
26 ms |
612 KB |
Output is correct |
31 |
Correct |
27 ms |
856 KB |
Output is correct |
32 |
Correct |
24 ms |
604 KB |
Output is correct |
33 |
Correct |
46 ms |
860 KB |
Output is correct |
34 |
Correct |
1 ms |
348 KB |
Output is correct |
35 |
Correct |
79 ms |
1008 KB |
Output is correct |
36 |
Correct |
8 ms |
604 KB |
Output is correct |
37 |
Correct |
2 ms |
348 KB |
Output is correct |
38 |
Correct |
1 ms |
348 KB |
Output is correct |
39 |
Correct |
2 ms |
356 KB |
Output is correct |
40 |
Correct |
2 ms |
360 KB |
Output is correct |
41 |
Correct |
2 ms |
360 KB |
Output is correct |
42 |
Correct |
2 ms |
360 KB |
Output is correct |
43 |
Correct |
2 ms |
360 KB |
Output is correct |
44 |
Correct |
2 ms |
360 KB |
Output is correct |
45 |
Correct |
4 ms |
360 KB |
Output is correct |
46 |
Runtime error |
1 ms |
616 KB |
Execution killed with signal 11 |
47 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
352 KB |
Output is correct |
5 |
Correct |
0 ms |
352 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
1 ms |
352 KB |
Output is correct |
8 |
Correct |
1 ms |
352 KB |
Output is correct |
9 |
Correct |
0 ms |
360 KB |
Output is correct |
10 |
Correct |
1 ms |
348 KB |
Output is correct |
11 |
Correct |
1 ms |
348 KB |
Output is correct |
12 |
Correct |
1 ms |
348 KB |
Output is correct |
13 |
Correct |
3 ms |
352 KB |
Output is correct |
14 |
Correct |
3 ms |
356 KB |
Output is correct |
15 |
Correct |
6 ms |
616 KB |
Output is correct |
16 |
Correct |
7 ms |
564 KB |
Output is correct |
17 |
Correct |
14 ms |
608 KB |
Output is correct |
18 |
Correct |
16 ms |
720 KB |
Output is correct |
19 |
Correct |
25 ms |
740 KB |
Output is correct |
20 |
Correct |
0 ms |
352 KB |
Output is correct |
21 |
Correct |
1 ms |
352 KB |
Output is correct |
22 |
Correct |
0 ms |
360 KB |
Output is correct |
23 |
Correct |
0 ms |
484 KB |
Output is correct |
24 |
Correct |
0 ms |
360 KB |
Output is correct |
25 |
Correct |
1 ms |
360 KB |
Output is correct |
26 |
Correct |
0 ms |
348 KB |
Output is correct |
27 |
Correct |
6 ms |
616 KB |
Output is correct |
28 |
Correct |
10 ms |
880 KB |
Output is correct |
29 |
Correct |
12 ms |
612 KB |
Output is correct |
30 |
Correct |
26 ms |
612 KB |
Output is correct |
31 |
Correct |
27 ms |
856 KB |
Output is correct |
32 |
Correct |
24 ms |
604 KB |
Output is correct |
33 |
Correct |
46 ms |
860 KB |
Output is correct |
34 |
Correct |
1 ms |
348 KB |
Output is correct |
35 |
Correct |
79 ms |
1008 KB |
Output is correct |
36 |
Correct |
8 ms |
604 KB |
Output is correct |
37 |
Correct |
2 ms |
348 KB |
Output is correct |
38 |
Correct |
1 ms |
348 KB |
Output is correct |
39 |
Correct |
2 ms |
356 KB |
Output is correct |
40 |
Correct |
2 ms |
360 KB |
Output is correct |
41 |
Correct |
2 ms |
360 KB |
Output is correct |
42 |
Correct |
2 ms |
360 KB |
Output is correct |
43 |
Correct |
2 ms |
360 KB |
Output is correct |
44 |
Correct |
2 ms |
360 KB |
Output is correct |
45 |
Correct |
4 ms |
360 KB |
Output is correct |
46 |
Runtime error |
1 ms |
616 KB |
Execution killed with signal 11 |
47 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
352 KB |
Output is correct |
5 |
Correct |
0 ms |
352 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
1 ms |
352 KB |
Output is correct |
8 |
Correct |
1 ms |
352 KB |
Output is correct |
9 |
Correct |
0 ms |
360 KB |
Output is correct |
10 |
Correct |
1 ms |
348 KB |
Output is correct |
11 |
Correct |
1 ms |
348 KB |
Output is correct |
12 |
Correct |
1 ms |
348 KB |
Output is correct |
13 |
Correct |
3 ms |
352 KB |
Output is correct |
14 |
Correct |
3 ms |
356 KB |
Output is correct |
15 |
Correct |
6 ms |
616 KB |
Output is correct |
16 |
Correct |
7 ms |
564 KB |
Output is correct |
17 |
Correct |
14 ms |
608 KB |
Output is correct |
18 |
Correct |
16 ms |
720 KB |
Output is correct |
19 |
Correct |
25 ms |
740 KB |
Output is correct |
20 |
Correct |
0 ms |
352 KB |
Output is correct |
21 |
Correct |
1 ms |
352 KB |
Output is correct |
22 |
Correct |
0 ms |
360 KB |
Output is correct |
23 |
Correct |
0 ms |
484 KB |
Output is correct |
24 |
Correct |
0 ms |
360 KB |
Output is correct |
25 |
Correct |
1 ms |
360 KB |
Output is correct |
26 |
Correct |
0 ms |
348 KB |
Output is correct |
27 |
Correct |
6 ms |
616 KB |
Output is correct |
28 |
Correct |
10 ms |
880 KB |
Output is correct |
29 |
Correct |
12 ms |
612 KB |
Output is correct |
30 |
Correct |
26 ms |
612 KB |
Output is correct |
31 |
Correct |
27 ms |
856 KB |
Output is correct |
32 |
Correct |
24 ms |
604 KB |
Output is correct |
33 |
Correct |
46 ms |
860 KB |
Output is correct |
34 |
Correct |
1 ms |
348 KB |
Output is correct |
35 |
Correct |
79 ms |
1008 KB |
Output is correct |
36 |
Correct |
8 ms |
604 KB |
Output is correct |
37 |
Correct |
2 ms |
348 KB |
Output is correct |
38 |
Correct |
1 ms |
348 KB |
Output is correct |
39 |
Correct |
2 ms |
356 KB |
Output is correct |
40 |
Correct |
2 ms |
360 KB |
Output is correct |
41 |
Correct |
2 ms |
360 KB |
Output is correct |
42 |
Correct |
2 ms |
360 KB |
Output is correct |
43 |
Correct |
2 ms |
360 KB |
Output is correct |
44 |
Correct |
2 ms |
360 KB |
Output is correct |
45 |
Correct |
4 ms |
360 KB |
Output is correct |
46 |
Runtime error |
1 ms |
616 KB |
Execution killed with signal 11 |
47 |
Halted |
0 ms |
0 KB |
- |