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

Автор wineColoredDays, история, 14 месяцев назад, По-английски

Hi folks. Is there any documentation regarding the architecture of Code Execution Service of Codeforces.

If someone is familiar, can you please briefly explain the design. Thanks a lot:)

Полный текст и комментарии »

  • Проголосовать: нравится
  • +8
  • Проголосовать: не нравится

Автор wineColoredDays, история, 8 лет назад, По-английски

Hi, searching anything in the search box (top right) on Codeforces home page is not showing any result as it used to be. can anyone explain why ? Thanks.

Полный текст и комментарии »

  • Проголосовать: нравится
  • +31
  • Проголосовать: не нравится

Автор wineColoredDays, история, 8 лет назад, По-английски

To all the Python Gods out there, can you please explain the concept of decorators in Python.

I need to understand how it works, what are its advantages, how can be it applied over functions and classes. And hold, how you keep track when there are multiple decorators applied to the same class or function. I mean how you visualize.

Thanks in advance :)

Полный текст и комментарии »

  • Проголосовать: нравится
  • +3
  • Проголосовать: не нравится

Автор wineColoredDays, история, 9 лет назад, По-английски

Hi Codeforces Community, Revision of solved problems is an important aspect of training . However, i'm extremely bad at this. I solve problems, but hardly revisit them due to reasons like laziness and greediness to solve more problems rather than resolving the solved ones again. Due, to this i am unable to solve the solved problems when i visit them after a long time. I would love to hear the various revision techniques you guys use during training. Do you only check your previous solution, or you code it again from scratch. Please, share your techniques so that we all can be benefited from each others experiences. Suggestions from people who have trained for IOI or ICPC will be greatly appreciated :)

Полный текст и комментарии »

  • Проголосовать: нравится
  • 0
  • Проголосовать: не нравится

Автор wineColoredDays, история, 9 лет назад, По-английски

Guys, i'm getting consistently WA on this problem HORRIBLE . I tried some inputs myself, but they are of no use . please help . Here is my code that uses segment tree + lazy propagation :

` #include <bits/stdc++.h> using namespace std;

typedef long long ll;
const int N = 1e5 + 5;

int n, c;
ll s[4 * N];
ll lazy[4 * N];

void upd(int id,int val, int l, int r){
    s[id] += (long long )(1LL * (r-l+1) * (1LL * val));
    lazy[id] += val;
}

void shift(int id, int l, int r){
    int mid = (l + r) / 2;
    upd(2 * id, lazy[id], l, mid);
    upd(2 * id + 1, lazy[id], mid + 1, r);
    lazy[id] = 0;
}

void increase(int x, int y, int val, int id = 1, int l = 1, int r = n){
    if(r < x or y < l) return;
    if(x <= l and r <= y){
       upd(id, val, l, r); 
       return;
    }
    shift(id, l, r);
    int mid = (l + r) / 2;
    increase(x, y, val, 2 * id, l, mid);
    increase(x, y, val, 2 * id + 1, mid + 1, r);
    s[id] = (s[2 * id] + s[2 * id + 1]);
}

ll query(int x, int y, int id = 1, int l = 1, int r = n){
    if(r < x or y < l) return 0;
    if(x <= l and r <= y){
       return s[id];
    }
    shift(id, l, r);
    int mid = (l + r) / 2;
    return query(x, y, 2 * id, l, mid) + query(x, y, 2 * id + 1, mid + 1, r);
}

int main() {

    int Test; cin >> Test;
    for(int t = 0; t < Test; t++){
       cin >> n >> c;

       for(int i = 0; i < N; i++){
         s[i] = 0;
         lazy[i] = 0;
       }

       for(int i = 0; i < c; i++){
         int type, p, q, v;
         cin >> type;

         if(type == 0){

          cin >> p >> q >> v;
          increase(p, q, v);
         }
         else{

         cin >> p >> q;
          ll ans = query(p, q);
          cout << ans << '\n';

         }
       }
    }
    return 0;
} `

Полный текст и комментарии »

  • Проголосовать: нравится
  • -5
  • Проголосовать: не нравится

Автор wineColoredDays, история, 9 лет назад, По-английски

I was unable to solve the problem GRID GAME ( GRID GAME ) during the recently conducted ICPC Preparatory Series by team Enigma . The reason being i couldn't write the correct code to check whether the xor of the series x, x+2, x+4, ..., x+2*m-2 is 0 or not . But, after the contest i saw several different approaches to the problem . Some of them involved just 5-10 lines of code whereas some involved 20-30 lines of code . I'm very interested in knowing your approach . Thanks in advance for sharing :)

Полный текст и комментарии »

  • Проголосовать: нравится
  • -8
  • Проголосовать: не нравится