@@huzaifaansari6195 I hope I ain't too late, here's the code. Maybe the code is Lil messy , if it's unclear to you plz let me know I can put down the approach. #include using namespace std; #define endl " " #define ll long long int #define vi vector #define KIT ios_base::sync_with_stdio(false),cin.tie(NULL) #define all(type) type.begin(), type.end() int32_t main() { KIT; int ttt; ttt=1; cin>>ttt; while(ttt--){ ll n; cin>>n; vector tea(n), tester(n); for(auto &x:tea)cin>>x; for(auto &x:tester)cin>>x;
vi v(n+5,0), extra(n+5,0), prefix(n); prefix[0]=tester[0]; for(int i=1; i
hey i don't know what wrong with this approach 🥲 when i'm submitting it's showing wrong on fifth test case i can't find any mistake in code even i tried exactly code what u have shown in video it's not accepting my code : #include using namespace std; int main() { int t; cin>>t; while(t--) { int n; cin>>n; vector a(n); vector b(n); for(int i=0; i>a[i]; for(int i=0; i>b[i]; long long used=0;
Common discord group- discord.gg/P5TEZB4zAr
(Beginners) The new coders- discord.gg/4DH3PWUX3t
(Intermediate) Pro coders- discord.gg/H8TeFjvq6z
Nice
lmao ur sacrificing the last 40 minutes of making a tutorial.🤣But great works btw! Came here with your comment and this helps a lot!
Haha. I always do this. Thanks for supporting
Initially I thought of the similar solution, but somewhere it wasn't working for me. Then I did it using difference array, it seemed more intuitive.
bro can you please share ur code that u did using difference array
@@huzaifaansari6195 I hope I ain't too late, here's the code. Maybe the code is Lil messy , if it's unclear to you plz let me know I can put down the approach.
#include
using namespace std;
#define endl "
"
#define ll long long int
#define vi vector
#define KIT ios_base::sync_with_stdio(false),cin.tie(NULL)
#define all(type) type.begin(), type.end()
int32_t main() {
KIT;
int ttt; ttt=1;
cin>>ttt;
while(ttt--){
ll n;
cin>>n;
vector tea(n), tester(n);
for(auto &x:tea)cin>>x;
for(auto &x:tester)cin>>x;
vi v(n+5,0), extra(n+5,0), prefix(n);
prefix[0]=tester[0];
for(int i=1; i
hey i don't know what wrong with this approach 🥲 when i'm submitting it's showing wrong on fifth test case
i can't find any mistake in code even i tried exactly code what u have shown in video it's not accepting
my code :
#include
using namespace std;
int main()
{
int t;
cin>>t;
while(t--)
{
int n;
cin>>n;
vector a(n);
vector b(n);
for(int i=0; i>a[i];
for(int i=0; i>b[i];
long long used=0;
multiset s;
for(int i=0; i
overflow probably ... use long long instead of int
fine ! got the mistake ! i used int for set instead of long long