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

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

Hi. I've just started working on some DP + graph problems recently, but I've gotten stuck on one. It gives you a graph with exactly one simple cycle with no other vertices (all n vertices are on the cycle) and ask you to find the total cost of the maximum independent set of the graph. I know that it is a modification of maximum independent set on trees, but I don't know how to deal with the cycle. The farthest I've gotten is adding the first node as node n+1 and the dp recurrence. Can someone help me?

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

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

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

Hi. I've been taking a look at this problem from APIO 2007. I'm not really proficient at these kinds of problems (greedy + heap, possibly applications of dp?). Do any of you guys have nice problems to recommend? As you can see from my rating, I'm not that good yet so don't give me Div 1. D and E problems please...

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

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

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

I know the answer is practice, practice, practice, and I think I already put in enough effort since everywhere I go I read CF problem and editorials :D.

However, sometimes practicing the wrong things at the wrong times can make you fail and become discouraged. As a beginning intermediate level competitive programming enthusiast, I've struggled with many problems that seem to be very trivial (most of these are div 2 C and D). I've also noticed that sometimes I try to work with too many problem types at the same time. So, I thought if I practiced one type of problem at a time, gaining mastery in each one, I will eventually become really good at CP. Right now, I'm working on DP, but after this, what types of problems should I do? I feel like I shouldn't touch segment trees and network flows for now, because they seem too hard. Anybody have any suggestions as to what order I should learn these problem types in? Or is my idea of learning one topic at a time wrong?

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

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

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

Maybe I'm not updated enough, but I can't seem to find any announcements about this. Mike, change my class to legendary grandmaster for me because I don't know how plz........

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

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

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

Hi, I just started competing on codeforces recently so I can know what a competitive programming environment looks like. I took part in the codeforces round 336 (div. 2 of course), and I only solved the first problem. However, my rating went straight to specialist, and I'm a little confused why that is. Is it because it's my first rated contest?

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

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

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

I'm not sure if this algorithm (or code perhaps) is correct or not. Any help would be greatly appreciated.

Examples use this test case:

9
1 2 1 3 2 2 2 2 3

The algorithm is:

  • Store the values and the sum of them all. For this test case it is:
    1: 2
    2: 10
    3: 6
  • Then, sort the list by how much the total sum of the list is reduced by. If any two elements have equal impact on the list, then we take whichever has the largest sum.
    1: 2: 10
    2: 3: 6
    3: 1: 2
  • Then proceed to remove the values

Code can be found on the submission: 13754753

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

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

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

Is there something wrong with this?

#include <iostream>
#include <string>
#include <vector>
using namespace std;

int main(){
    string s;
    cin >> s;
    vector<int> bears;
	int len = s.length();
    for(int i = 0; i < len; i++){
        if(s[i] == 'b' && i+3 < len){
            if(s[i+1] == 'e' && s[i+2] == 'a' && s[i+3] == 'r') bears.push_back(i);
        }
    }
    int bi = 0;
    long long count = 0;
    for(int i = 0; i <= bears[bears.size()-1]; i++){
        if(i <= bears[bi]) count += len-(bears[bi]+3);
        else{
            if(bi < bears.size()-1) count += len-(bears[++bi]+3);
        }
    }
    cout << count;
}

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

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