# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
908002 | 12345678 | trapezoid (balkan11_trapezoid) | C++17 | 1076 ms | 5640 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
const int nx=1e5+5, mod=30013;
struct trapezoid
{
int a=0, b=0, c=0, d=0;
bool operator< (const trapezoid &o) const {
return a<o.a;
}
} s[nx];
int n, dp[nx], cnt[nx], mx, res;
int main()
{
cin.tie(NULL)->sync_with_stdio(false);
cin>>n;
for (int i=1; i<=n; i++) cin>>s[i].a>>s[i].b>>s[i].c>>s[i].d;
sort(s+1, s+n+1);
cnt[0]=1;
for (int i=1; i<=n; i++)
{
for (int j=0; j<i; j++)
{
if (s[i].a>s[j].b&&s[i].c>s[j].d)
{
if (dp[j]+1>dp[i]) dp[i]=dp[j]+1, cnt[i]=cnt[j];
else if (dp[j]+1==dp[i]) cnt[i]=(cnt[i]+cnt[j])%mod;
}
}
mx=max(mx, dp[i]);
}
for (int i=1; i<=n; i++) if (dp[i]==mx) res=(res+cnt[i])%mod;
cout<<mx<<' '<<res;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |