# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
967191 | Roman70 | 사다리꼴 (balkan11_trapezoid) | C++17 | 1079 ms | 3664 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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... |