32:28 #include #include using namespace std; #define ll long long int main() {char nexchar,lastchar; vectorvec; bool isfirst=true; vec.push_back(0);int i=0; while ((nexchar=getchar())!=' ') { // don't forget; if (isfirst) { isfirst=false; lastchar=nexchar; vec.push_back(i); continue; } if(lastchar!=nexchar) { vec.push_back(i); lastchar=nexchar; } else { vec.push_back(++i); lastchar=nexchar; } } int num,l,r; cin>>num;while(num--) { cin>>l>>r; printf("%d ",vec[r]-vec[l]); } } // ms.erase(ms.begin()); //setseto;//same as piriority queue but it is sorted and unique حل الولد دا صح
شرحك عظمة اتمنى تكمل لغاية ما تعمل كتاب فى problem solving
انا اول واحد هيشتريه
تسلم ربنا يخليك♥️
هيبقي صعب شوية موضوع الكتاب دا
لان هيحتاح وقت ومجهود كبار وللاسف مفيش حاليا
عاااااش😍😍😍😍😍😍
ممكن لينك المسألة الأولى (D. range sum query)
Static range query = size slide window? and thanks for you.
No
Sliding window is an application of topic called (( 2 pointers ))
it's the subject of the next session
@@mahmoudayman8873 ❤
32:28 #include
#include
using namespace std;
#define ll long long
int main() {char nexchar,lastchar;
vectorvec;
bool isfirst=true;
vec.push_back(0);int i=0;
while ((nexchar=getchar())!='
') {
// don't forget;
if (isfirst) {
isfirst=false;
lastchar=nexchar;
vec.push_back(i);
continue;
}
if(lastchar!=nexchar) {
vec.push_back(i);
lastchar=nexchar;
}
else {
vec.push_back(++i);
lastchar=nexchar;
}
}
int num,l,r;
cin>>num;while(num--)
{
cin>>l>>r;
printf("%d
",vec[r]-vec[l]);
}
}
// ms.erase(ms.begin());
//setseto;//same as piriority queue but it is sorted and unique
حل الولد دا صح