Educational Codeforces Round 168 | Video Solutions - A to D | by Harsh Gupta | TLE Eliminators
ฝัง
- เผยแพร่เมื่อ 8 ก.ย. 2024
- Here are the video solutions in the form of a post-contest discussion for problems A, B, C, D of Educational Codeforces Round 168. The live discussion was done with students of TLE Eliminators, this is the recording of the same. We hope this will be useful for you in up-solving this contest.
📢Check out handpicked problems by Priyansh himself, on our CP-31 sheet: www.tle-elimin...
Solution Codes:
Strong Password: codeforces.com...
Make Three Regions: codeforces.com...
Even Positions: codeforces.com...
Maximize the Root: codeforces.com...
Be sure to check out TLE Eliminators.
Website: www.tle-elimin...
Instagram: / tle_eliminators
Linkedin: / tle-eliminators
Twitter: / tle_eliminators
TLE Community Discord Server: / discord
Timestamps:-
0:00 Problem A
Problem B
Problem C
Problem D
Learn from the best! TLE 11.0 offers live classes with top mentors. Join TLE 11.0 today at www.tle-eliminators.com 🚀🚀🚀
please add time stamps it helps alot
nice explanation buddy
D was cool. thank harsh
Please fill the Feedback form for PCD: forms.gle/Puc5UJri7p7gn7Nm6
please add time stamps it helps alot
What website are you using as online board, pretty dope.
Microsoft Power Point
Please explain the problem F
D was too much good
can anybody give me the explanation of c using stack...
#include
using namespace std;
int main()
{
int t;
cin >> t;
while (t--)
{
int n;
cin >> n;
string s;
cin >> s;
int count = 0;
stack st;
for (int i = 0; i < n; i++)
{
if (s[i] == '(')
{
st.push({'(', i});
}
if (s[i] == '_')
{
if (!st.empty())
{
int j = st.top().second;
st.pop();
count += (i - j);
}
else st.push({'(', i});
}
if (s[i] == ')')
{
int j = st.top().second;
st.pop();
count += (i - j);
}
}
cout
@@dhruvvarshney2805 thank you
void run() {
int n;
cin >> n;
string s;
cin >> s;
stack st; // store starting index
int ans = 0;
for(int i = 0; i < s.length(); i++) {
if(s[i] == '(') {
st.push(i);
}
else if(s[i] == ')') {
ans += i-st.top();
st.pop();
}
else if(s[i] == '_') {
if(st.empty()) {
st.push(i);
}
else {
ans += i-st.top();
st.pop();
}
}
}
cout
@@pratyush2331raj thank you
#include
#include
using namespace std;
int main() {
int t;
cin>>t;
while(t--){
int n;
cin>>n;
string s1;
cin>>s1;
int r=n-1;
unsigned long long count=0;
while(r>=0){
int cal=r-1;
while(cal>=0 && s1[cal]!=')'){
if(s1[cal]=='('){
count=count+1;
}
cal--;
}
int val=r-cal;
count=count+(val-1);
r=cal;
}
cout
-test- *comment*