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>
#define fi first
#define se second
#define ll long long
#define pb push_back
using namespace std;
int n,m,a[25],b[25];
vector<pair<int,int>> vv,truyvan;
bool ans[25];
void trau(vector<pair<int,int>>& v)
{
if(v.size()==1)
{
for(int i=0;i<=truyvan.size()-1;i++)
{
if(truyvan[i]==v[0])
{
ans[i]=true;
}
}
return;
}
for(int i=0;i<=v.size()-2;i++)
{
vector<pair<int,int>> u;
for(int j=0;j<=v.size()-1;j++)
{
if(j==i)
{
int mina=min(v[j].fi,v[j+1].fi),minb=min(v[j].se,v[j+1].se);
j++;
u.push_back({mina,minb});
}
else u.push_back(v[j]);
}
trau(u);
u.clear();
for(int j=0;j<=v.size()-1;j++)
{
if(j==i)
{
int maxa=max(v[j].fi,v[j+1].fi),maxb=max(v[j].se,v[j+1].se);
j++;
u.push_back({maxa,maxb});
}
else u.push_back(v[j]);
}
trau(u);
}
}
int main()
{
ios::sync_with_stdio(0);
cin.tie(0);cout.tie(0);
// freopen(".INP","r",stdin);
// freopen(".OUT","w",stdout);
cin>>n>>m;
for(int i=1;i<=n;i++)
{
cin>>a[i]>>b[i];
vv.pb({a[i],b[i]});
}
for(int i=1;i<=m;i++)
{
int u,v;
cin>>u>>v;truyvan.pb({u,v});
}
trau(vv);
for(int i=1;i<=m;i++)
{
if(ans[i-1]) cout<<i<<' ';
}
return 0;
}
Compilation message (stderr)
Main.cpp: In function 'void trau(std::vector<std::pair<int, int> >&)':
Main.cpp:15:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
15 | for(int i=0;i<=truyvan.size()-1;i++)
| ~^~~~~~~~~~~~~~~~~~
Main.cpp:25:15: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
25 | for(int i=0;i<=v.size()-2;i++)
| ~^~~~~~~~~~~~
Main.cpp:28:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
28 | for(int j=0;j<=v.size()-1;j++)
| ~^~~~~~~~~~~~
Main.cpp:42:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
42 | for(int j=0;j<=v.size()-1;j++)
| ~^~~~~~~~~~~~
# | 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... |