How to keep doing when one feel severely devastated by chronic rating decrease and at the same time determined to raise it up?
# | User | Rating |
---|---|---|
1 | tourist | 3985 |
2 | jiangly | 3814 |
3 | jqdai0815 | 3682 |
4 | Benq | 3529 |
5 | orzdevinwang | 3526 |
6 | ksun48 | 3517 |
7 | Radewoosh | 3410 |
8 | hos.lyric | 3399 |
9 | ecnerwala | 3392 |
9 | Um_nik | 3392 |
# | User | Contrib. |
---|---|---|
1 | cry | 169 |
2 | maomao90 | 162 |
2 | Um_nik | 162 |
4 | atcoder_official | 161 |
5 | djm03178 | 158 |
6 | -is-this-fft- | 157 |
7 | adamant | 155 |
8 | awoo | 154 |
8 | Dominater069 | 154 |
10 | luogu_official | 150 |
How to keep doing when one feel severely devastated by chronic rating decrease and at the same time determined to raise it up?
I have not find any editorial of this 345A - Expecting Trouble . Can anyone please explain how to solve this ?
My observation is : Let an array A has length n and a subset of A is B. Now, if B has length k then it appears also in other 2^(n-k) subsets of array A.
So I used a 2d dp dp[i][j] which denotes if I take elements upto i then how many subsets have remaining sum j. And the ans is dp[n][0].
Base case is when i >= n then if the remaining sum is 0 that means we got a subset having sum S. Now we have to return in how many other subsets the current segment belongs. So if remaining sum = 0 then I returned pow(2,n-k) otherwise 0;
I thought this is the correct approach. Please correct my approach. I don't understand why it is not working.
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pb push_back
#define sf(x) scanf("%d",&x)
#define sfl(x) scanf("%lld",&x)
#define pf(x) printf("%d\n",x)
#define pfl(x) printf("%lld\n",x)
#define endl '\n'
#define MOD 998244353
ll binPow(ll a, ll q) {
a %= MOD;
if (q == 0) return 1;
return ((q % 2 == 1 ? a : 1) * binPow(a * a, q / 2)) % MOD;
}
ll n;
ll ar[4000];
ll dp[3009][3009];
ll sol(ll i,ll remaining_sum,ll cnt)
{
if(i>=n)
{
if(remaining_sum == 0)
{
return binPow(2ll,n-cnt);
}
else return 0;
}
if(dp[i][remaining_sum] != -1)return dp[i][remaining_sum];
if(remaining_sum == 0)
{
return binPow(2ll,n-cnt);
}
ll ans = 0;
ans = (ans + sol(i+1,remaining_sum-ar[i],cnt+1) + sol(i+1,remaining_sum,cnt))%MOD;
return dp[i][remaining_sum] = ans;
}
int main()
{
ll i,j,k,l,m,s;
sfl(n);
sfl(s);
for(i=0;i<n;i++)sfl(ar[i]);
memset(dp,-1,sizeof dp);
pfl(sol(0,s,0));
}
In this 615D - Multipliers after analyzing some cases, I saw that,
If a number n = p1^a * p2^b * p3^c.
Then for the answer, the contribution of each prime is something like -
Let that , calculating the contribution of p1 --->
x = (a * (a+1) )/2;
y = (b+1)*(c+1) [ That is , how many divisors are there without the prime p1]
z = x*y
so the contribution of p1 is p1^z
To calculate y , I had to use two loops. And got TLE 86303876 . How to optimize this portion?
I have been doing cp for 2 years . I admit that I have not pushed me harder. But right now when I have realized that I should have , I am blank. Basically I am facing stuck situation and disbelief in me what I have made over time. But I want to bounce back harder. But somewhere in me I cannot believe that I can do.
Does anybody face these , but later bounced back to some extent ? More generally , what do you think that what mindset or what made you to keep doing even after you are seeing that you are a Failure ?
What do you think what made you to be better from a very low situation ?
Given a string S. How many permutations of string s is lexicographically smaller than S . If S = "cda" answer will be 3 . And the strings are {"acd","adc","cad"}.
I am good for nothing . I cannot do a single thing daily that will boost my confidence . I make mess. I am messmaker .
In this 316E3 - Summer Homework how to perform 2nd and 3rd type query with segment tree ? Thanks in Advance.
766C - Mahmoud and a Message . I thought it to be a variation of stars and bars and so implemented 83511343. But got WA in test case 6. It is because I thought longest substring over all the ways would be minimum of all ai . I understood my mistake . Now , I saw the editorial , it was dp solution . Can anyone please explain it clearly ? Thanks.
In this 294C - Shaass and Lights I do not understand clearly what to do next. I have figured out that if there are n off lights between two on lights , number of ways to turn them on is 2^(n-1) . And for consecutive off lights having only one adjacent on light can only be turned on in one way. In the third sample test case lights from 5 to 7 can be turned on in 2^2 ways . And lights from 1 to 3 can be turned on in 1 way. Also, lights from 9 to 11 can be turned on in 1 way. So answer will be X * 1 * 4 * 1 . Now how to find this "X" ??
If in this 1197D - Yet Another Subarray Problem range of m is m <= n , how to approach ?
Please anyone help me with this 98A - Help Victoria the Wise . I do not understand how the solution of editorial is approached.
How to solve this 1313C2 - Небоскрёбы (усложнённая версия) with segment tree ?
In this atcoder problem,I do not understand how to approach. I am weak at expected value and probabilities . Please suggest me any good source to learn expected value from the beginning .
Can anyone make a good virtual dp practice contest ? Basically it will consist of several dp problems from easy to hard.
I have dp basic idea and I have learnt most known topics like knapsack,coin change,lcs. Also I solved few problems.
But still I am not good at it.
Please anyone explain the proof of the editorial of 893E - Подсчет массивов . Specially , how using the stirling number is satisfying the solution? In the solution , they calculated for every prime number of x separately and then multiplied.
I understand the calculation for negative elements part.
Here in this 1073C - Vasya and Robot my observations are -
1)If (abs(x) + abs(y)) < string_length then ans -1
2)If (abs(x) + abs(y)) > string_length and ((abs(x) + abs(y))-string_length)%2 != 0 then also ans -1
Then I was thinking like, okay only way can be binary approach or any tiring greedy approach. But none of these could not help to proceed. Because If I will use binary search, how can I increase or decrease the length.
Do not put any direct solution. Just hints or just let me know where my thinking is wrong?
Here in this CF problem my observations are —
1) There cannot be more paths than n-1
2)If you start going right from any cell , you cannot go upward or downward after its next cell. If the grids are -
A B C D E
F G H I J
You cannot go — A->B->G ....
or A->F->G->H->C...
But I do not know how to proceed further.
In the tutorial they said about calculating prefixes , suffixes . But how these gonna help in handling the time of visiting a cell?
Hey wait ! please help , I want to learn to solve 1600-1800 problems within contest time. So help me :p
Name |
---|