Комментарии
+34

I couldn't submit my solution for C in the last 40 minutes, and I believe others are experiencing a similar situation. Please, unrate this round.

Why is rating relapsed? Recalculation? EDIT 3: it keeps on relapsing and fixing itself... strange.

На QuickSolver → Japan orz, 5 лет назад
0

What is better than anime?

На OLDACCOUNT → How to learn English?, 6 лет назад
+1

Sure, for attaining normal conversations just consuming them is sufficient; I wrote about truly fine literacy and more of a standardized English language — with emphasis on concision, precision, and simplicity. Appreciation of a language and its beauty is worthwhile, and though your personal anecdote is considerable, one can hardly imagine a person possessing enough skill to read great books, but not consuming (and producing) day-to-day English and being good at it too. And just to nail it down, it's long been proven that learning of language is all-input. Here's a quote from Washington Post: "The results of studies done over the last few decades by a wide variety of researchers and published in scientific journals support this view: We do not master languages by hard study and memorization, or by producing it. Rather, we acquire language when we understand what people tell us and what we read, when we get “comprehensible input.” As we get comprehensible input through listening and reading, we acquire (or “absorb”) the grammar and vocabulary of the second language."

На OLDACCOUNT → How to learn English?, 6 лет назад
-10

ignore

0

Can you please provide a link to the problem?

Compress $$$A$$$, and let $$$M=min(N, A)$$$. Now you have $$$O(MNlogM)$$$.

Auto comment: topic has been updated by prudent (previous revision, new revision, compare).

Auto comment: topic has been updated by prudent (previous revision, new revision, compare).

На _Evoiz_ → how to solve this problem ?, 8 лет назад
0

Sorry, I totally misunderstood problem.

На _Evoiz_ → how to solve this problem ?, 8 лет назад
0

Edited: Sorry, I totally misunderstood problem.

Автокомментарий: текст был обновлен пользователем prudent (предыдущая версия, новая версия, сравнить).

Спасибо

На gur_chella → Dynamic Programming question, 8 лет назад
+14

He means following:
Let dp[i][j] be max score which we can achieve by distributing first i elements into j groups
Then recurrence is: dp[i][j] = max(dp[t][j - 1] + f(t + 1, i)) where: j - 1 ≤ t < i and f(l, r) is number of inversions in segment [l, r]
In order to optimize this solution you should previously compute f[l][r] over all l ≤ r, overall with trivial implementation, you can achieve O(n3) which seems to be enough, since n ≤ 500

На Myshyk → HELP ROI Kazakhstan!!!, 8 лет назад
0

Более понятная реализация, где delta[b][i] сразу же обозначает разницу которую сделает установление i-того бита x-а на b:

using ll = long long;
const int BITS = 40;
const int HALF = BITS / 2;

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    int n;
    ll total;
    cin >> n >> total;
    vector<vector<ll>> delta(2, vector<ll>(BITS));
    for (ll x; n--;) {
        cin >> x;
        for (int b : {0, 1})
            for (int i = 0; i < BITS; i++) {
                ll bit = ((x >> i) & 1);
                bit ^= b;
                delta[b][i] += (bit << i);
            }
    }
    map<ll, int> owner;
    for (int mask = 0; mask < (1 << HALF); mask++) {
        ll sum = 0;
        for (int i = 0; i < HALF; i++)
            sum += delta[(mask >> i) & 1][i];
        owner[sum] = mask;
    }
    for (ll submask = 0; submask < (1 << HALF); submask++) {
        ll mask = (submask << HALF);    
        ll sum = 0;
        for (int i = HALF; i < BITS; i++)
            sum += delta[(mask >> i) & 1][i];
        if (owner.find(total - sum) != owner.end())
            cout << (mask | owner[total - sum]), exit(0);                           
    }
    cout << -1;
    return false;
}                                                                               
На Myshyk → HELP ROI Kazakhstan!!!, 8 лет назад
0

Спасибо!

На Myshyk → HELP ROI Kazakhstan!!!, 8 лет назад
0

Спасибо!

На Myshyk → HELP ROI Kazakhstan!!!, 8 лет назад
0

Спасибо. Не знаете где можно сдать?

На Myshyk → HELP ROI Kazakhstan!!!, 8 лет назад
0

можно подробней?

На Myshyk → HELP ROI Kazakhstan!!!, 8 лет назад
0

Где можно сдать?

The same thing man, I can be expert for the first time in my whole life after 2 years of work, if this round will be rated, please let it be so.

Why, you set  - value[i] to i instead of 0? Don't we need to neutralize/erase it?

go?

На prudent → Xor of unique values on segment, 8 лет назад
0

Don't You know why I get TLE?
If You know/can know by viewing my code, please say me where's my mistake.

На prudent → Xor of unique values on segment, 8 лет назад
0

I implemented it, but I'm getting TLE which I shouldn't get because my solution uses O(NlogN) memory, right? Can You please view my submission 39701020?

Thank You :)

OMG, I'm blown away, thank You!
World of bits is so amazing!

На prudent → Xor of unique values on segment, 8 лет назад
0

WOW, great solution, I'll definitely implement it!
Thank You very much!

Auto comment: topic has been updated by prudent (previous revision, new revision, compare).

Thank You very much, great explanation!

На prudent → Xor of unique values on segment, 8 лет назад
0

Does he mean last j < i, that Aj = Ai?

My friend told me that it's satisfied when all bits are unique. Yes that makes sense and it's true. But is it the only case when xorsum is equal to sum?

На prudent → Xor of unique values on segment, 8 лет назад
0

Doesn't such j always exist, since j ≥ i and Aj = Ai?

На prudent → Xor of unique values on segment, 8 лет назад
0

Can You please further explain how can I apply it?

На prudent → Need help in generalization of formula, 8 лет назад
0

You didn't say anything about co-primeness between x and y. If it's easier for You to speak and write in Russian, do it. I can speak Russian, too. Can You please explain to me problem's statement again, please. (if more preferable for You, in Russian). And please, give some samples with explanations, if possible.

На prudent → Need help in generalization of formula, 8 лет назад
0

Solution is:

And this can be further optimized until O(sqrt(n)logsqrt(n)), since there are at most 2sqrt(n) unique values of n / d, among all 1 ≤ d ≤ n

На prudent → Need help in generalization of formula, 8 лет назад
0

Auto comment: topic has been updated by prudent (previous revision, new revision, compare).

На prudent → Need help in generalization of formula, 8 лет назад
0

What is a constraint for n?
If I understood statement right, problem asks You to calculate:

doesn't it?

It can be rewritten as:

⌊n / 1⌋ + ⌊n / 2⌋ + ⌊n / 3⌋ + ... + ⌊n / n⌋
2⌊n / 2⌋ + ⌊n / 3⌋ + ... + ⌊n / n⌋
3⌊n / 3⌋ + ... + ⌊n / n⌋
На prudent → Need help in generalization of formula, 8 лет назад
0

Thank You very very extremely much!
I understood concept after a few hours on paper! And I finally solved it in O(Qsqrt(N) + NlogN)!

My solution: 39462553. I missed some stuff there and original problem asked to calculate

But however, by understanding concept I could further generalize it and solve, thank You very much again!

На paramsingh → Help with spoj problem AKBAR, 8 лет назад
0

I didn't even read a problem's statement, but by just looking to your code, I see some not reliable things...

You should write:
for (it = adj[s].begin(); it != adj[s].end(); it++) And since you don't need iterator, You better use:
for (int value : adj[s])

На prudent → Need help in generalization of formula, 8 лет назад
0

Amazing!
I thought about such approach too, but didn't get to the end.
I'd like to first implement O(Qsqrt(N)logsqrt(N)) solution. But there's one trouble...
I understood that I didn't understand nothing at all... (maybe it makes You sad too in a meaning of such waste of time on me, I'm very sorry if it is).

Can You please explain it to me one more time! And to find out gaps as fast as possible, I'll try to show You how much I didn't get.

Let n = 10
Then I just go to its root floored down -> 3
And there, I consider pairs and update their occurrences:
(1, 10)
(2, 5)
(3, 3) // but don't add second time, since they're equal

Here's what I get:
Occurrences: 1 1 1 0 1 0 0 0 0 1
___Numbers: 1 2 3 4 5 6 7 8 9 10

But result should be:
Occurrences: 10 5 3 2 2 1 1 1 1 1
____Numbers: 1 2 3 4 5 6 7 8 9 10

What I do wrong?

На prudent → Need help in generalization of formula, 8 лет назад
0

Wonderful!
Do You think if there exists solution faster than O(qsqrt(n)logsqrt(n))? Or is it just me so silly and straightforward?

На prudent → Need help in generalization of formula, 8 лет назад
0

Thank You!
I meant: 'I thought there're  ≤ 2sqrt(n) only divisors of n and that's the only thing which we can find in O(sqrt(n))'.
Can You please provide some other similar examples?

На prudent → Need help in generalization of formula, 8 лет назад
0

Wow, thank You very much, I thought it's fact only when d|n, is it so with a lot of other concepts, too? If it is, can You please provide some examples, I'm very grateful for your response.

На -Morass- → Problem Topics, 8 лет назад
0

Well, can You please help me out with one more issue, when I try to register to icpcarchive.ecs.baylor.edu, it gives me this error, how to fix it?

На -Morass- → Problem Topics, 8 лет назад
0

Good day to You too, I'm sorry to ask such a question, but I really couldn't really find where I can submit problem called "8015 — Alice and Bob play Contact" in a division trie_string, because when I go to UVA and insert a value 8015 in a problem id in a Quick Submit, I get a message: "The selected problem ID does not exist.", what is its actual id by which I can submit the problem?

На vovuh → Разбор Educational Codeforces Round 43, 9 лет назад
0

problem B

can You please explain why we don't consider the case, when we do -1 to k, by decreasing height of our final answer?

На Acedbysomeone → Stay positive., 9 лет назад
0

So, do you recommend to NOT watch friends' standings while contest?

0

Hello Everyone, can someone please explain me solution of Div.2 E with more details?

I'll be grateful if someone'll, any help is appreciated!

More exactly: how does it work & why does it work?

На Wild_Hamster → Codeforces #308 (Div. 2) Editorial , 9 лет назад
0

Can someone please explain me how to turn some value into a w-ary representation? Because as I know it's always possible to turn any number to only BinaryRepresentation, sorry for my English if there're some mistakes. Thanks in advance!

На Livace → Codeforces Round #442 (Div. 2). Editorial., 9 лет назад
+3

Wow, thank you so much, I struggled with this problem for a long time!

На Livace → Codeforces Round #442 (Div. 2). Editorial., 9 лет назад
0

here's my submission: 36150483

На Livace → Codeforces Round #442 (Div. 2). Editorial., 9 лет назад
0

Thank you a lot for such a great response & I'm really sorry for my so long one.

Everything is pretty clear, but I still didn't get the idea why I should save direction.

Because let's assume that we stay in state (x, y), and we'll just brute force some count in range[1; k] and anyway we'll do +1 to our adjacents to which we can go in one step.

На Livace → Codeforces Round #442 (Div. 2). Editorial., 9 лет назад
0

Can you please explain why do we need to save direction, too?

На unbelievable02 → IZHO 2018, 9 лет назад
0

Thank you so much!

На unbelievable02 → IZHO 2018, 9 лет назад
0

Would you please explain me why answer is always subarray of length 1 or 2?

And would You please define a notion of subarray?, is it a continuous segment in array?

fact: depth[lca(a, b)] >= depth[lca(a, b, c)]

Let's denote V as set of vertices which are in subtree(v), so if we'll increase size of V, lca of all vertices of V won't at least become more distant from v, so all we need to do is find two vertices(x, y), lca(x, y) = v & if we'll denote i as index of x and j as index of y in array, is it correct that all vertices in range[i, j] in array must be in subtree(v) to say that answer for current query is (x, y)?

Thanks in advance!

UPD: I forgot that fact that those vertices (x, y) must be in two different children of vertex v, how should I do there?

UPD': Probably, I got it! Thank you very much! But here's last request to confirm something: if we have set of vertices V that all vertices locate in subtree of v, will it be correct & enough to consider always & only adjacent vertices from set V?

Можете ли вы высказаться почему? Жадность с минимальным остовом в графе чтобы превратить его в дерево, или что-то другое?

Yeah, I've got that asymptotics'll be O(nlogn) and why, and I also have written CentroidDecomposition several times, but I still didn't get one thing, why it takes all possible n2 or n * (n - 1) / 2 cases?

And if your answer's going to be DivideAndConquer again, would you please explain why it is correct?

Я не знаю правильно ли это или нет, но попробуй что-нибудь такое:

Построй минимальный остов для этого ориентированно-взвешенного графа, потом у тебя получиться дерево, затем задача сводиться к нахождению длины наикратчайшего пути между вершинами (u, v), делаешь с помощью LCA O(logn) на запрос

Итоговая асимптотика O((n + q)logn + m)

UPD: Асимптотики O(logn) на запрос можно достигнуть с помощью Бинарного подъема

I mean, how does CentroidDecomposition consider all n2 cases in O(nlogn)

Thank you very much for this beautiful implementation. I have a request, would you please explain to me how CentroidDecomposition considers all n2 cases?

На Opportunity → Binary Lifting Problems?, 9 лет назад
+4

588E - Duff in the Army. Nice problem, maybe some complex implementation, but if You'll solve it, You'll definitely have no problems with Binary Rise

На repeating → Which IDE do you use?, 9 лет назад
+8

tourist would to use Far Manager as C++ IDE

На ODT → Codeforces Round #449 Editorial, 9 лет назад
+1

hah, just luck, unfortunately, it this problem's solution was tutorialed here... many of us could get more rating for this round)

На ODT → Codeforces Round #449 Editorial, 9 лет назад
+5

Hello everyone! I'd like to solve Div.2(A) in O(M log N), can someone give me a clue how to realize it with segment tree?

На adamant → C++ STL: Policy based data structures, 9 лет назад
0

спасибо, то есть он лишь проверяет есть ли этот элемент в set-e или нет?

На adamant → C++ STL: Policy based data structures, 9 лет назад
0

Можете ли вы пожалуйста объяснить почему это равносильно функции count ?

На awoo → Разбор Educational Codeforces Round 33, 9 лет назад
0

thanks a lot, my inattention(

На awoo → Разбор Educational Codeforces Round 33, 9 лет назад
0

Can someone explain me "Segment Tree structure" solution for "F" ?