yogomate's blog

By yogomate, history, 18 months ago, In English

Hi i was solving this problem. I even figured out the logic for the following problem . My solution first when i submitted it it gave WA on tc3 but when I again submitted it, it gave WA on tc10 and when I did that again it gave WA on tc12 (no changes were made during the following). is there something wrong with my code. It would be great of someone helped me :)

Full text and comments »

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

By yogomate, history, 21 month(s) ago, In English

problem link :- https://codeforces.me/problemset/problem/1684/C In the given editorial of problem C the code is wrong I think. lets assume that there is a matrix where in which after swapping two colums every row is sorted . but the jth colum will be push_back every time we do it for new row so even if the incorrect columns are 2 there the size of vector bad will increase thus giving the wrong answer. Am i correct please tell me it or wrong if wrong please tell me.

Code in the editorial :-

#include <bits/stdc++.h>

using namespace std;

void solve(vector<vector<int>> &a) {
    int n = a.size(), m = a[0].size();
    vector<int> bad;
    for (int i = 0; i < n && bad.empty(); i++) {
        vector<int> b = a[i];
        sort(b.begin(), b.end());
        for (int j = 0; j < m; j++) {
            if (a[i][j] != b[j]) bad.push_back(j);
        }
    }
    if ((int)bad.size() == 0) {
        cout << 1 << " " << 1 << "\n";
        return;
    }
    if ((int)bad.size() > 2) {
        cout << -1 << "\n";
        return;
    }
    for (int i = 0; i < n; i++) {
        swap(a[i][bad[0]], a[i][bad[1]]);
    }
    for (int i = 0; i < n; i++) {
        for (int j = 1; j < m; j++) {
            if (a[i][j] < a[i][j - 1]) {
                cout << -1 << "\n";
                return;
               }
        }
    }
    cout << bad[0] + 1 << " " << bad[1] + 1 << "\n";
    return;
}

int main() {
    #ifdef LOCAL
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #else
        ios_base::sync_with_stdio(0);
        cin.tie(0);
        cout.tie(0);
    #endif
    int T;
    cin >> T;
    while (T--) {
        int n, m;
        cin >> n >> m;
        vector<vector<int>> a(n, vector<int>(m));
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < m; j++) {
                cin >> a[i][j];
            }
        }
        solve(a);
    }
    return 0;
}

Full text and comments »

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

By yogomate, history, 22 months ago, In English

here i have a recursion code specifically a binary search code(recurion) ll bs(ll l, ll h, vector wins[], ll k, ll i)// { if(l<=h) { ll m=(l+h)/2;

if(wins[i][m]<=k){
        if(m+1<=h){
            if(wins[i][m+1]<=k){
                return bs(m+1, h, wins, k, i);
            }else{
                return m+1;
            }
        }else{
            return m+1;
        }
    }else{
        return bs(l, m-1, wins, k, i);
    }
}else{
    return 0;
}

} and i converted it to while loop binary search but i am not getting desired output my code : ll binary(vector wincnt, ll player, vector rounds[], ll k){ int ans = 0; ll l = 0; ll r = wincnt[player]-1; while(l <= r){ int mid = l + (r — l) / 2; if(mid+1<=r){ if(rounds[player][mid+1]<=k){ l = mid+1; }else{ return m+1; } } else{ r = mid-1; } } return ans; } what did i do wrong

Full text and comments »

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

By yogomate, history, 22 months ago, In English

Hi I am yogomate I post stuipd blogs asking for help if I don't understand a problem. But all people do is ignore it and downvote it personally I don't have any problem with downvoting, it may be because the question I ask in my blog as stupid and you must be getting really annoyed by that, but if you are going to downvote atleast help me with a comment and feel free to downvote to you hearts content I have no problem. But if you are going to downvote without help you have no right to do it. Its not like I forced you to answer. I also know I will still get many downvotes on this but what can i do. Most of my friends don't do CP and in my collage also there is know one who does CP in India this is what you get in tier 3 collages so due to this I post blog cause I have no one to ask.

Full text and comments »

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

By yogomate, history, 22 months ago, In English

here is the link to the problem line :- https://codeforces.me/contest/569/problem/A i don't get it what is x in this question my uderstanding s is distance speed is 1-(q-1)/q >> (q-q+1)/q >> 1/q then time = s/(1/q) >> s*q so why is it the distance increase rate after s dist help many people don't react to my blogs it will be big help

Full text and comments »

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

By yogomate, history, 22 months ago, In English

Hi i am unable to understand the problem can you please help me the link for problem :- https://codeforces.me/contest/311/problem/A It would be of great help if you give your valueable time to explain me this

Full text and comments »

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

By yogomate, history, 22 months ago, In English

hi I am stuck on this problem figuring out what is this question is asking. for eg if traveling from school a ot school b ticket cost is (a+b)%(n+1) the nwhy for test case 2 cost is not 0 we can travel form 1 to n, 2 to n-1 ...n/2 to n/2 +1 and the cost will be zero to travel to n,n-1..n/2+1 and to travel from 1 to n/2 we will choose n/2+1 to n schools as starting point and the ans will be still zero

Full text and comments »

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

By yogomate, history, 23 months ago, In English

hi i am sloving this problem problem and i wrote this solution for it solution i dont know what did i do wrong but its been too long and i am not able to figure it out please help me. also please help me on my last blog to that question is also difficult

Full text and comments »

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

By yogomate, history, 2 years ago, In English

problem link link for problem i didn't understand the problem like the part about extra time a and 2*a <= v i looked up to a editorial but there was no explainaiton i didn't get why v has to be 2*amin please explain me

Full text and comments »

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

By yogomate, history, 2 years ago, In English

I didn't understood last sample test case really well Here is the question :- https://codeforces.me/problemset/problem/416/B can anyone explain me i am stuck on this problem for a long time

Full text and comments »

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

By yogomate, history, 2 years ago, In English

I am having a problem in which I am not able to view problem properly here is an example "Polycarp bought a new expensive painting and decided to show it to his **

Unable to parse markup [type=CF_MATHJAX]

$** friends. He hung it in his room. _

Unable to parse markup [type=CF_MATHJAX]

$_ of his friends entered and exited there one by one. At one moment there was no more than one person in the room. In other words, the first friend entered and left first, then the second, and so on." instead of hypertext or bold words i get something like "

Unable to parse markup [type=CF_MATHJAX]

$" Please I request you to kindly tell me what the problem is, is it because of my browser or my computer or it is a bug in the website. Your help will be appreciated.

Full text and comments »

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