Блог пользователя Shayan

Автор Shayan, история, 7 недель назад, По-английски
  • Проголосовать: нравится
  • +126
  • Проголосовать: не нравится

»
7 недель назад, # |
  Проголосовать: нравится +9 Проголосовать: не нравится

Why are the video editorials (made by Shayan, who to my knowledge had no relationship with the problemsetting of today's round) being downvoted? Anyway, thank you Shayan for these video editorials. Always appreciate them.

»
7 недель назад, # |
Rev. 2   Проголосовать: нравится +17 Проголосовать: не нравится

All those downvotes are coming from the people who craved these good solutions during the contest.

»
7 недель назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Great explanation for problem E, very easy to understand. I think that if the problem statement was clearer with saying that the special balls were on the first k positions there would be more ACs.

  • »
    »
    7 недель назад, # ^ |
      Проголосовать: нравится 0 Проголосовать: не нравится

    They already said ' The first k balls are special'. Problem being they wrote it in input section of the problem.

»
7 недель назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

thanks

»
7 недель назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Thanks for these video solutions Shayan . Helped a lot!

»
7 недель назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Hi Shayan,

For problem F, you said that, while counting the subarrays having xor value less than k, there will be a index j for index each index i, such that all the subarray's xor values will be less than or equal to k. can you prove this ?

»
7 недель назад, # |
  Проголосовать: нравится -51 Проголосовать: не нравится

Can Anyone please help me understanding why my code is failing as tle on tc 16 ,though its a nlogn approach and should pass according to the constraints

include

include

include

include

include

using namespace std; typedef long long int ll;

ll bin(vector a,ll l,ll r,ll target){

ll si=l+1;
ll ei=r;
ll ans=-1;
while(si<=ei){
    ll mid=(si+ei)/2;

    if(a[mid]-a[l]>=target){
        ans=mid;
        ei=mid-1;
    }else{
        si=mid+1;
    }
}
return ans;

}

int main() {

ll t;
cin >> t;

while (t--) {
    ll n;
    cin>>n;
    vector<ll> arr1(n,0);
    vector<ll> arr2(n,0);
    vector<ll> arr3(n,0);
    ll i=0;
    ll j=0;
    ll k=0;
    double tot=0;
    for(ll i=0;i<n;i++){
        cin>>arr1[i];
        tot+=arr1[i];
    }
    for(ll i=0;i<n;i++){
        cin>>arr2[i];
    }
    for(ll i=0;i<n;i++){
        cin>>arr3[i];
    }
    tot=ceil(tot/3);
    for(ll i=1;i<n;i++){
        arr1[i]=arr1[i-1]+arr1[i];
        arr2[i]=arr2[i-1]+arr2[i];
        arr3[i]=arr3[i-1]+arr3[i];
    }

    vector<pair<ll,ll>> ans;
    for(ll i=0;i<n;i++){
        if(arr1[i]>=tot){
            ll j=bin(arr2,i,n-1,tot);

            if(j!=-1){
                ll k=arr3[n-1]-arr3[j];
                if(k>=tot){
                    ans.push_back({0,i});
                    ans.push_back({i+1,j});
                    ans.push_back({j+1,n-1});
                    break;
                }
            }
            j=bin(arr3,i,n-1,tot);
            if(j!=-1){
                ll k=arr2[n-1]-arr2[j];
                if(k>=tot){
                    ans.push_back({0,i});
                    ans.push_back({j+1,n-1});
                    ans.push_back({i+1,j});
                    break;
                }
            }
        }
        if(arr2[i]>=tot){
            ll j=bin(arr1,i,n-1,tot);

            if(j!=-1){
                ll k=arr3[n-1]-arr3[j];
                if(k>=tot){

                    ans.push_back({i+1,j});
                    ans.push_back({0,i});
                    ans.push_back({j+1,n-1});
                    break;
                }
            }
            j=bin(arr3,i,n-1,tot);
            if(j!=-1){
                ll k=arr1[n-1]-arr1[j];
                if(k>=tot){

                    ans.push_back({j+1,n-1});
                    ans.push_back({0,i});
                    ans.push_back({i+1,j});
                    break;
                }
            }
        }
        if(arr3[i]>=tot){
            //cout<<arr3[i]<<" "<<tot<<endl;
            ll j=bin(arr1,i,n-1,tot);

            if(j!=-1){
                ll k=arr2[n-1]-arr2[j];
                if(k>=tot){

                    ans.push_back({i+1,j});
                    ans.push_back({j+1,n-1});
                    ans.push_back({0,i});
                    break;
                }
            }
            j=bin(arr2,i,n-1,tot);
            if(j!=-1){
                ll k=arr1[n-1]-arr1[j];
                if(k>=tot){

                    ans.push_back({j+1,n-1});
                    ans.push_back({i+1,j});
                    ans.push_back({0,i});
                    break;
                }
            }
        }
    }
    if(ans.size()>=3){
        for(ll i=0;i<3;i++){
            cout<<ans[i].first+1<<" "<<ans[i].second+1<<" ";
        }
        cout<<endl;
    }
    else{
        cout<<-1<<endl;
    }

}
return 0;

}

»
7 недель назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

How about moving these wonderful video into China. They really benefits a lot!

  • »
    »
    7 недель назад, # ^ |
      Проголосовать: нравится 0 Проголосовать: не нравится

    But it's a pity that I can't use VPN.

    • »
      »
      »
      7 недель назад, # ^ |
        Проголосовать: нравится 0 Проголосовать: не нравится

      What exactly do you mean by moving it to China. You mean move it to another platform instead of YT?