# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
315138 | yjojdkgk5bp | Costinland (info1cup19_costinland) | C++14 | 1052 ms | 23852 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
#define sec second
#define ft first
#define pb push_back
using namespace std;
ll k,dp[50][50],sum1[50][50],sum2[50][50],mx,a,b;
vector<pair<int,int>> p;
int ans[50][50];
int main()
{
cin >> k;
dp[0][1]=1;
for(int i=1; i<33; i++)
for(int j=1; j<33; j++)
{
dp[i][j]=dp[i-1][j]+dp[i][j-1];
sum1[i][j]=sum1[i-1][j]+dp[i][j];
sum2[i][j]=sum2[i][j-1]+dp[i][j];
ll v=sum1[i][j]+sum2[i][j];
if(sum1[i][j]+sum2[i][j]<=k && i>=j &&max(i,j)<=5 && (mx<v || (mx==v&&max(i,j)<max(a,b))))
mx=v,a=i,b=j;
}/*
for(int i=32; i&&k; i--)
for(int j=i; j&&k; j--)
{
if(sum1[i][j]+sum2[i][j]<=k)
{//
k-=sum1[i][j]+sum2[i][j];
p.pb({i,j});
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |