Can someone tell how for S>=2N, Petya wins in the following problem with also the approach?
Problem Link:https://mirror.codeforces.com/problemset/problem/1355/D I am not able to get the editorial and the approach. Please Help. !!!!
# | User | Rating |
---|---|---|
1 | tourist | 4009 |
2 | jiangly | 3823 |
3 | Benq | 3738 |
4 | Radewoosh | 3633 |
5 | jqdai0815 | 3620 |
6 | orzdevinwang | 3529 |
7 | ecnerwala | 3446 |
8 | Um_nik | 3396 |
9 | ksun48 | 3390 |
10 | gamegame | 3386 |
# | User | Contrib. |
---|---|---|
1 | cry | 167 |
2 | Um_nik | 163 |
3 | maomao90 | 162 |
3 | atcoder_official | 162 |
5 | adamant | 159 |
6 | -is-this-fft- | 158 |
7 | awoo | 157 |
8 | TheScrasse | 154 |
9 | Dominater069 | 153 |
9 | nor | 153 |
Can someone tell how for S>=2N, Petya wins in the following problem with also the approach?
Problem Link:https://mirror.codeforces.com/problemset/problem/1355/D I am not able to get the editorial and the approach. Please Help. !!!!
Problem Link :https://mirror.codeforces.com/contest/1607/problem/E
How is the below solution working ?? I found this in submission relatively easier than others . Can someone explain the intuition behind it? What I have understood is that we can move opposite to the direction s[i] in the string to get the required cooordinate. Can someone give a proper explanation for this and why are traversing string in the reverse direction?
#include <bits/stdc++.h>
using namespace std;
int main(){
int t;
cin>>t;
while(t--){
int n,m;
cin>>n>>m;
string s;
cin>>s;
int x=1,y=1;
for(int i=s.size()-1;i>=0;i--){
if(s[i]=='L'&&x<m)x++;
if(s[i]=='R'&&x>1)x--;
if(s[i]=='U'&&y<n)y++;
if(s[i]=='D'&&y>1)y--;
}
cout<<y<<" "<<x<<endl;
}
}
Can someone help me in fiding error in my code ?? It is failing on a test case but I am not able to figure it out . Problem Link : https://mirror.codeforces.com/contest/1562/problem/C
My logic :
Case 1 — string contains all 1s then simply print starting and ending indexes of any two substrings of length greater than n/2. as they will be multiple of each other . like 11111111 >>> 1111 and 1111 their decimal values both will be multiple of each other .
Case 2 — if the first zero is finding at length less than or = to n/2 then print the index of a substring starting from there till the end and other excluding that zero and till the end. Like 101111 >>> 01111 and 1111, their decimal values both will be multiple of each other .
Case 3 — if the first zero is at length greater than n/2 then print the index of a substring starting from index 1 till it and the other starting from 1 to l-1. ****
I think it is failing on Case 1 But not able to figure it out why and where Please Help!!!!!
void solve()
{
ll n;cin>>n;string s;cin>>s;
ll l=-1;
for(int i=0;i<n;i++)
{
if(s[i]=='0')
{
l = i+1;
break;
}
}
if(l==-1)
{
cout<<1<<" "<<n/2<<" "<<n/2+1<<" "<<n<<"\n";return ;
}
if(l<=n/2)
{
cout<<l<<" "<<n<<" "<<l+1<<" "<<n<<"\n"; return ;
}
else
{
cout<<1<<" "<<l<<" "<<1<<" "<<l-1<<"\n";return ;
}
}
Can someone help me in solving this game theory problem? I am not able to get the discussions /editorial , this problem is very tough . Please Help !!!!!!!!!!
Problem Link :
Problem Link :https://mirror.codeforces.com/contest/322/problem/B
The problem seems easy but there are two cases . I am not able to get case 2 which is explained in the editorial .
Case 1: First take out max of mixed flowers whcih we can make and then make individual flowers. long long mixed = min(min(r,g),b); r = r- mixed; g = g-mixed; b= b- mixed; long long ans1 = (mixed) +(r/3)+(g/3)+(b/3);
but I am not able to get case 2. maximum of two cases will be my answer.
Please Help !!!!!!!
How to solve this problem using Dp ??? I read the editorial and found that it has been solved using combinatorics but I saw others have solved it using Dp approach.
Problem Link -https://mirror.codeforces.com/contest/1288/problem/C
Please Help !!!! Thanks in advance
Problem Link :
https://mirror.codeforces.com/problemset/problem/1313/C1
Can someone help me in solving this greedy problem ????
I thought of 2 passes left and right and storing max and then changing the elements and then comparing the sum of both sides(left and right) but it is not working , Can someone suggest a good approach to solve this problem. There is no tutorial for this problem .
Thank You in advance.
Yesterday 's contest had some very good problems , unfortunately, it became unrated.
Problem Link : https://mirror.codeforces.com/contest/1573/problem/C
The problem is based on standard topological sort Prerequisite problem .
If the cycle was found in the graph I printed -1 as the answer.
else I found the topical sort of all the chapters , using cycle detection + DFS + queue.
After finding the topological ordering of chapters (stored in a queue a ->b->c->d.... )how do I count the number of times I will have to read the book/number of passes required ???
Please help !!!
Can someone help me in solving this problem?? The problem editorial is tough to understand. It can be solved using hashmap +prefix sum but I am not able to the get the pattern/observation.
C. Good Subarrays Educational Codeforces Round 93 Problem Link :https://mirror.codeforces.com/problemset/problem/1398/C
Can someone help me in solving this greedy problem ?? https://mirror.codeforces.com/problemset/problem/276/C I am not able to understand the editorial .
Thanks in advance !!!! Happy coding !!!
How to solve this problem using bitmask or bit manuplation ??
Problem Link :https://mirror.codeforces.com/problemset/problem/1097/B Editorial Link :https://mirror.codeforces.com/blog/entry/64310
I am not able to understand the editorial which says that clockwise rotation will be done if ith bit is set to 0 and vive versa ?? Can someone explain in detail ?
Name |
---|