Submission #967191

#TimeUsernameProblemLanguageResultExecution timeMemory
967191Roman70trapezoid (balkan11_trapezoid)C++17
23 / 100
1079 ms3664 KiB
#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 timeMemoryGrader output
Fetching results...