#include<bits/stdc++.h>
typedef long long ll;
#define pb push_back
#define mp make_pair
#define fi first
#define se second
using namespace std;
int n,i,ta,tb,tc,td,j,h1,h2,d[101010];
vector<int> v[101010];
pair<pair<int,int>,pair<int,int> > A[101010];
int depe(int aa)
{
if(d[aa]==-1)
{
d[aa]=0;
int ii;
for(ii=0;ii<v[aa].size();ii++)
d[aa]=max(d[aa],depe(v[aa][ii]));
d[aa]++;
}
return d[aa];
}
int main()
{
ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
cin>>n;
for(i=1;i<=n;i++)
{
cin>>ta>>tb>>tc>>td;
A[i]=mp(mp(ta,tb),mp(tc,td));
}
for(i=1;i<=n;i++)
for(j=1;j<=n;j++)
if(A[i].fi.se<A[j].fi.fi&&A[i].se.se<A[j].se.fi)
v[i].pb(j);
memset(d,-1,sizeof(d));
for(i=1;i<=n;i++)
h1=max(h1,depe(i));
cout<<h1<<" "<<h2<<"\n";
}
Compilation message
trapezoid.cpp: In function 'int depe(int)':
trapezoid.cpp:17:14: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for(ii=0;ii<v[aa].size();ii++)
~~^~~~~~~~~~~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Partially correct |
5 ms |
3064 KB |
Partially correct |
2 |
Partially correct |
4 ms |
3192 KB |
Partially correct |
3 |
Partially correct |
7 ms |
3704 KB |
Partially correct |
4 |
Partially correct |
16 ms |
5628 KB |
Partially correct |
5 |
Partially correct |
41 ms |
11384 KB |
Partially correct |
6 |
Partially correct |
89 ms |
23404 KB |
Partially correct |
7 |
Partially correct |
163 ms |
40460 KB |
Partially correct |
8 |
Partially correct |
130 ms |
14968 KB |
Partially correct |
9 |
Runtime error |
241 ms |
65540 KB |
Execution killed with signal 9 (could be triggered by violating memory limits) |
10 |
Runtime error |
210 ms |
65540 KB |
Execution killed with signal 9 (could be triggered by violating memory limits) |
11 |
Runtime error |
229 ms |
65540 KB |
Execution killed with signal 9 (could be triggered by violating memory limits) |
12 |
Runtime error |
266 ms |
65540 KB |
Execution killed with signal 9 (could be triggered by violating memory limits) |
13 |
Runtime error |
250 ms |
65540 KB |
Execution killed with signal 9 (could be triggered by violating memory limits) |
14 |
Runtime error |
248 ms |
65540 KB |
Execution killed with signal 9 (could be triggered by violating memory limits) |
15 |
Runtime error |
265 ms |
65540 KB |
Execution killed with signal 9 (could be triggered by violating memory limits) |
16 |
Runtime error |
266 ms |
65540 KB |
Execution killed with signal 9 (could be triggered by violating memory limits) |
17 |
Runtime error |
304 ms |
65540 KB |
Execution killed with signal 9 (could be triggered by violating memory limits) |
18 |
Runtime error |
276 ms |
65540 KB |
Execution killed with signal 9 (could be triggered by violating memory limits) |
19 |
Runtime error |
288 ms |
65540 KB |
Execution killed with signal 9 (could be triggered by violating memory limits) |
20 |
Runtime error |
289 ms |
65540 KB |
Execution killed with signal 9 (could be triggered by violating memory limits) |