kakashi.'s blog

By kakashi., history, 4 years ago, In English

I don't know if I'm completely wrong, but reading the editorial for the Hacked Exam problem, maybe they overcomplicated the solutions for test sets 1 and 2. I just figured that, with T/F questions, adding a second student with a lower score doesn't change the expected value. So, the answer is to just replicate the best student (or the worst one inverted, for that matter). Does it make sense or I just got lucky to have passed with this idea? Thanks for any help! And please follow the code below.

string inv(string a) {
    string r;
    trav(x, a) {
        if(x == 'T') r += 'F';
        else r += 'T';
    }
    return r;
}

void run_test() {
    int n, q; read(n, q);
    int mx = 0;
    string ans;
    rep(k, n) {
        string a; read(a);
        int s; read(s);
        if(s <= q / 2) a = inv(a), s = q-s;
        if(s > mx) {
            mx = s;
            ans = a;
        }
    }
    cout << ans << " " << mx << "/1" << endl;
}

Full text and comments »

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

By kakashi., history, 4 years ago, In English

Hi, Codeforces!

A friend of mine came to me with a very interesting problem that I wasn't able to figure out. The idea is: he have the the holdings positions of a portfolio of stocks (i.e. x% in stock A, y% in stock B, z% in stock C, etc) but this database is outdated by a couple of months. But he have daily data about change in percentage points of the whole portfolio and, of course, the variations of all the stocks in the market. So, the goal is to, based on these data points, to get an estimate of the current composition of the portfolio.

Any ideia of how I should proceed?

Thanks!

Full text and comments »

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