adyyy's blog

By adyyy, history, 4 years ago, In English

Hi, if there is a problem such that we are given an array of size (1<=n<=1e5) and queries (1<=q<=1e5) , int each query we are given a range [L,R] and we have to tell that if the array is increasing in that range or not . Also if we had a query for point update can this be solved ???? I was solving https://www.codechef.com/problems/DELSORT this problem so just thought about this question . I dont know if similar question already exists , if it does please provide link . Thanks .

Full text and comments »

  • Vote: I like it
  • +2
  • Vote: I do not like it

By adyyy, history, 4 years ago, In English

Hey, Can we calculate LIS with queries in an online manner ?? I have read about a offline method using DAG but how to process online ?

Full text and comments »

  • Vote: I like it
  • -33
  • Vote: I do not like it

By adyyy, history, 4 years ago, In English

Hi is there anybody here who has recently gave an internship interview at google through google online coding challenge ????

Full text and comments »

  • Vote: I like it
  • -29
  • Vote: I do not like it

By adyyy, history, 4 years ago, In English

I just wanted to understand the mentality of people who can't help others but only do down votes. If I message someone personally then they act like they are so much superior or busy . At last what can anyone do except posting it here . Even before this I have posted too many problems so that anyone can help but I only recieved downvotes .I mean I have asked spoj problems and it is quite obvious that i dont have code for it still you guys behave like .... ugh

Full text and comments »

  • Vote: I like it
  • -31
  • Vote: I do not like it

By adyyy, history, 4 years ago, In English

https://www.spoj.com/problems/ADAFIMBR/ can anyone please tell me what modification I can do in my code to accept this problem . It gives TLE to me right now .

#include<bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds;  
#define ordered_set tree<pair<int,int>, null_type,less<pair<int,int>>, rb_tree_tag,tree_order_statistics_node_update> 

#define ll  int
#define intmax INT_MAX
#define pi 3.14159265358979323846
#define ff first 
#define ss second
#define pb push_back
#define watch(x) cerr<<(#x)<<"  "<<x<<"\n";
int mod=1e9+7;
const int MAXN = 1e5+2,MAXM=3e6+3;
int a[MAXN],k,ans[MAXM];

vector<int> fib(2),dp[MAXM];

inline int mex(int x){
    unordered_map<int,int> m;
    for(int i=0;i<(int)dp[x].size();i++) m[dp[x][i]]++;
    int ap=0;
    while(m[ap]) ap++;
    return ap;
}

int main(){ 
int tt=1; 
ios_base::sync_with_stdio(0);
cout.tie(0); 
//~ cin>>tt;
while(tt--){
int n; cin>>n;

for(int i=0;i<n;i++) { cin>>a[i]; }
fib[0]=fib[1]=1;
for(int i=0;i<100;i++)if(fib[i]+fib[i+1]<=3e6)fib.pb(fib[i]+fib[i+1]); else break;
k=fib.size();

for(int i=0;i<=3e6;i++){
    if(i>=1) {
       ans[i]=mex(i);
    }
    for(int j=0;j<k;j++){
      if(i+fib[j]>MAXM) continue;
      else  dp[i+fib[j]].pb(ans[i]);   
    }
}

int an=0;
for(int i=0;i<n;i++) an^=ans[a[i]];

if(an)cout<<"Ada\n";
else cout<<"Vinit\n";
}

    return 0;
}

Full text and comments »

  • Vote: I like it
  • -25
  • Vote: I do not like it

By adyyy, history, 4 years ago, In English

https://www.hackerearth.com/problem/algorithm/minimum-moves-2-a32572f7/description/?layout=old Can anyone please help me with this problem . Editorial for this problem is just shit . Thanks .

Full text and comments »

  • Vote: I like it
  • -6
  • Vote: I do not like it

By adyyy, history, 4 years ago, In English

Hi I tried to solve this problem based on bfs https://codeforces.net/problemset/problem/198/B . Also I have implemented it well and it passes for 28 test cases butgives MEMORY LIMIT EXCEE. on test 29 . May be there is something to learn here . please anybody hep if you can figure out whats wrong . Here is my submission https://codeforces.net/contest/198/submission/85799856 . THANKS

Full text and comments »

  • Vote: I like it
  • 0
  • Vote: I do not like it

By adyyy, history, 4 years ago, In English

https://codeforces.net/gym/100739/problem/A Can anyone please help me out with this problem. It has no editoial.

Full text and comments »

  • Vote: I like it
  • -13
  • Vote: I do not like it

By adyyy, history, 5 years ago, In English

can anyone please explain me this binary search problem....... it has no editorial also i am not getting the soution ..... https://codeforces.net/contest/460/problem/C ..... thankyou

Full text and comments »

  • Vote: I like it
  • 0
  • Vote: I do not like it

By adyyy, history, 5 years ago, In English

hi can anybody please check out my solution for problem (https://codeforces.net/contest/20/problem/C)

.... my code... i am consistently getting WA at test 33.... https://codeforces.net/contest/20/submission/70403794

THanks and sorry for my poor english

Full text and comments »

  • Vote: I like it
  • -17
  • Vote: I do not like it

By adyyy, history, 5 years ago, In English

PLease someone help me with the binary search.... as I seen this far there never exists a single binary search technique for all the problems or may exists and I dont know . Anyways please help me if I have a function f(x) and i have to check for a k in [1 to n] such that f(k) is just >=m . f(x)=x*(x+1)/2; example n=9 m=22 ans=7; please tell someone..... P.S sorry for my poor english

Full text and comments »

  • Vote: I like it
  • -10
  • Vote: I do not like it

By adyyy, history, 5 years ago, In English

Heya , respected sir who are seeing my post i just want to seek some advice from all of u... i have been doing competetive programming from last 4 months tilll now i have only participated in long challenges on codechef..... the problem is that i am able to solve simple brute force problems but m not getting proper path to move further i mean wat to study exactly ..... please suggest me something that from where i can study in a sequence..... it would be a great help... THANKS

Full text and comments »

  • Vote: I like it
  • +3
  • Vote: I do not like it