# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
967191 | Roman70 | trapezoid (balkan11_trapezoid) | C++17 | 1079 ms | 3664 KiB |
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 ll long long
using namespace std;
struct trapezoid{
ll a,b,c,d;
};
bool cmp(trapezoid &a, trapezoid &b){
return a.a < b.a;
}
const int sz = 1e5+1;
int dp[sz];
const int mod = 30013;
int main()
{
int n;
cin >> n;
trapezoid a[n];
for(int i = 0 ;i<n;i++){
cin >> a[i].a >> a[i].b >> a[i].c >> a[i].d;
}
sort(a,a+n,cmp);
int ans = 0;
map<int,int>cnt;
for(int i = n-1;i>=0;i--){
dp[i] = 1;
for(int j = i;j<n;j++){
if(a[i].b < a[j].a && a[i].d < a[j].c) dp[i] = max(dp[i],dp[j]+1);
}
ans = max(ans,dp[i]);
}
ll ans2 = 0;
for(int i = 0; i < n; i++){
for(int j = i+1;j<n;j++){
if(a[i].b < a[j].a && a[i].d < a[j].c && dp[j] == ans-1) ans2 = (ans2 + 1) % mod;
}
}
cout<<ans<<" "<<ans2;
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |