This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
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 (stderr)
Main.cpp:16:18: warning: use of 'auto' in parameter declaration only available with '-fconcepts-ts'
16 | auto &operator<<(auto &o, pair<auto, auto> p) {
| ^~~~
Main.cpp:16:32: warning: use of 'auto' in parameter declaration only available with '-fconcepts-ts'
16 | auto &operator<<(auto &o, pair<auto, auto> p) {
| ^~~~
Main.cpp:16:38: warning: use of 'auto' in parameter declaration only available with '-fconcepts-ts'
16 | auto &operator<<(auto &o, pair<auto, auto> p) {
| ^~~~
Main.cpp:18:17: warning: use of 'auto' in parameter declaration only available with '-fconcepts-ts'
18 | auto operator<<(auto &o, auto x)->decltype(end(x), o) {
| ^~~~
Main.cpp:18:26: warning: use of 'auto' in parameter declaration only available with '-fconcepts-ts'
18 | auto operator<<(auto &o, auto x)->decltype(end(x), o) {
| ^~~~
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |