#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;
ll n,i,ta,tb,tc,td,j,h1,h2,d[101010];
vector<ll> v[101010];
pair<pair<ll,ll>,pair<ll,ll> > A[101010];
ll depe(ll aa)
{
if(d[aa]==-1)
{
d[aa]=0;
ll 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 'll depe(ll)':
trapezoid.cpp:17:14: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for(ii=0;ii<v[aa].size();ii++)
~~^~~~~~~~~~~~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Partially correct |
5 ms |
3576 KB |
Partially correct |
2 |
Partially correct |
5 ms |
3576 KB |
Partially correct |
3 |
Partially correct |
9 ms |
4600 KB |
Partially correct |
4 |
Partially correct |
19 ms |
8568 KB |
Partially correct |
5 |
Partially correct |
48 ms |
18812 KB |
Partially correct |
6 |
Partially correct |
101 ms |
38776 KB |
Partially correct |
7 |
Runtime error |
144 ms |
65540 KB |
Execution killed with signal 9 (could be triggered by violating memory limits) |
8 |
Partially correct |
140 ms |
26872 KB |
Partially correct |
9 |
Runtime error |
150 ms |
65536 KB |
Execution killed with signal 9 (could be triggered by violating memory limits) |
10 |
Runtime error |
171 ms |
65540 KB |
Execution killed with signal 9 (could be triggered by violating memory limits) |
11 |
Runtime error |
178 ms |
65540 KB |
Execution killed with signal 9 (could be triggered by violating memory limits) |
12 |
Runtime error |
188 ms |
65540 KB |
Execution killed with signal 9 (could be triggered by violating memory limits) |
13 |
Runtime error |
190 ms |
65540 KB |
Execution killed with signal 9 (could be triggered by violating memory limits) |
14 |
Runtime error |
180 ms |
65536 KB |
Execution killed with signal 9 (could be triggered by violating memory limits) |
15 |
Runtime error |
194 ms |
65540 KB |
Execution killed with signal 9 (could be triggered by violating memory limits) |
16 |
Runtime error |
196 ms |
65540 KB |
Execution killed with signal 9 (could be triggered by violating memory limits) |
17 |
Runtime error |
230 ms |
65536 KB |
Execution killed with signal 9 (could be triggered by violating memory limits) |
18 |
Runtime error |
207 ms |
65540 KB |
Execution killed with signal 9 (could be triggered by violating memory limits) |
19 |
Runtime error |
221 ms |
65536 KB |
Execution killed with signal 9 (could be triggered by violating memory limits) |
20 |
Runtime error |
220 ms |
65536 KB |
Execution killed with signal 9 (could be triggered by violating memory limits) |