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

Автор Barichek, история, 10 лет назад, По-русски

Всем привет!

29 марта в 19:05 MSK состоится рейтинговый Codeforces Round #407.

Задачи готовили я — Игорь Баренблат, Станислав giraffeh Томаш и Антон arsijo Цыпко. Большое спасибо Ивану Fekete Фекете, Адальберту Adalbert Макаровичу, Роману chyckchyryk Деркачу, Владиславу winger Исенбаеву и Александру AlexFetisov Фетисову за тестирование, Николаю KAN Калинину за помощь в подготовке раунда, а также Михаилу MikeMirzayanov Мирзаянову за системы Codeforces и Polygon.

Как всегда участникам будет предложено по пять задач и два часа на их решение. Разбалловка будет объявлена ближе к началу раунда.

Надеемся каждый найдет для себя интересную задачу. Всем успешного раунда и повышения в рейтинге!

Разбалловка:

Div2: 500-1000-1500-2250-2500

Div1: 500-1250-1500-2000-2250

UPD. Разбор опубликован.

Поздравляем победителей:

Div.1:

  1. -XraY-

  2. Um_nik

  3. EvenImage

  4. YuukaKazami

  5. Syloviaely

Div.2:

  1. KacaMG00

  2. LAGBOYDaD3zZ

  3. __W__

  4. GoogleBot

  5. shas20

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

»
10 лет назад, скрыть # |
← Rev. 2  
Проголосовать: нравится +23 Проголосовать: не нравится

Nowadays number of problem setters+tester of each contests are more than the number of problems :D That's cool. Thanks to all the problem setters for giving their important time in problem setting for us B-)

»
10 лет назад, скрыть # |
 
Проголосовать: нравится +13 Проголосовать: не нравится

Hope to have interesting problems and good problem description.

»
10 лет назад, скрыть # |
← Rev. 50  
Проголосовать: нравится -94 Проголосовать: не нравится

wish high rating for all

»
10 лет назад, скрыть # |
← Rev. 2  
Проголосовать: нравится +1 Проголосовать: не нравится

:|

»
10 лет назад, скрыть # |
 
Проголосовать: нравится -7 Проголосовать: не нравится

How many problems?

»
10 лет назад, скрыть # |
 
Проголосовать: нравится +83 Проголосовать: не нравится

who is maria ivanova Barichek ?

»
10 лет назад, скрыть # |
 
Проголосовать: нравится -26 Проголосовать: не нравится

I will be in top 1000 this contest!

»
10 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

Well I m new in programming contests ... Can you plz tell me that in in which Division should I register.....It will be great if you can give some tips to me .

»
10 лет назад, скрыть # |
← Rev. 2  
Проголосовать: нравится +77 Проголосовать: не нравится

Rating prediction: div1 div2

Extensions:

Have fun & high rating:)

»
10 лет назад, скрыть # |
 
Проголосовать: нравится -39 Проголосовать: не нравится

Is a2oj down?

»
10 лет назад, скрыть # |
 
Проголосовать: нравится +44 Проголосовать: не нравится

I believe I can fly.

»
10 лет назад, скрыть # |
 
Проголосовать: нравится +58 Проголосовать: не нравится

Good luck in the competition! Here's a little song to hype y'all up!


Beautiful program
Please run for me.
I've tried you in BASIC,
FORTRAN and C.
Beautiful program,
You've errors galore.
And each time I run you,
You're swapped out of core.

»
10 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

В задаче D есть ограничение на кол-во прямых?

»
10 лет назад, скрыть # |
 
Проголосовать: нравится +12 Проголосовать: не нравится

Problems in CSAcademy are getting better than DIV2 CF Rounds. Long Problems, uneven difficulty levels.

»
10 лет назад, скрыть # |
 
Проголосовать: нравится +9 Проголосовать: не нравится

Is it at all possible that problem E is just named "New task" because it is a placeholder name :P?

»
10 лет назад, скрыть # |
 
Проголосовать: нравится +6 Проголосовать: не нравится

Hack page not loading... Can someone please check?

»
10 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

Problem with the hack page :/

»
10 лет назад, скрыть # |
 
Проголосовать: нравится +3 Проголосовать: не нравится

Today we are going to witness the fastest system tests ever .

»
10 лет назад, скрыть # |
 
Проголосовать: нравится +8 Проголосовать: не нравится

Hi div2 :V

»
10 лет назад, скрыть # |
 
Проголосовать: нравится +3 Проголосовать: не нравится

RIP RATINGS...

»
10 лет назад, скрыть # |
 
Проголосовать: нравится +3 Проголосовать: не нравится

what's test #14 in B Div2?

»
10 лет назад, скрыть # |
← Rev. 2  
Проголосовать: нравится 0 Проголосовать: не нравится

What is pretest 14 in div2 B ? Your text to link here... What is wrong in my solution?

»
10 лет назад, скрыть # |
 
Проголосовать: нравится +5 Проголосовать: не нравится

How to solve Div2B. Got stuck for 1 hr.

»
10 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

What could be Problem B test 14 ?

»
10 лет назад, скрыть # |
 
Проголосовать: нравится +17 Проголосовать: не нравится

How to solve C?

»
10 лет назад, скрыть # |
 
Проголосовать: нравится +25 Проголосовать: не нравится

This >.<

»
10 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

Hacks, Hacks everywhere 8-) <3

»
10 лет назад, скрыть # |
← Rev. 5  
Проголосовать: нравится +30 Проголосовать: не нравится

Is Div1 D solvable by Java? I think the solution needs almost 300000 queries. An Educational Codeforces Round held some month ago has such problem (many queries needed) and no one can solve by Java since flush() is time-consuming.

»
10 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

Can somebody tell, if for div1B suggestion, that 2 used only once edges are neighbour edges, is right?

»
10 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

Awesome problem set! problems was tricky though xD

»
10 лет назад, скрыть # |
← Rev. 2  
Проголосовать: нравится +3 Проголосовать: не нравится

Pretty nice contest. My most favorite problem is Div2-D. Though, I don't like Div2-B.

Btw, how to solve Div2-E? Is it some kind of DP?

UDP: I don't know if the words "geometric" and "depression" in Div2-B title are intended puns or not.

  • »
    »
    10 лет назад, скрыть # ^ |
     
    Проголосовать: нравится 0 Проголосовать: не нравится

    Solve the multivariate linear indeterminate equation? I guess...

  • »
    »
    10 лет назад, скрыть # ^ |
     
    Проголосовать: нравится +3 Проголосовать: не нравится

    The crux here is to notice that all we need is the sum of (signed) distances of the cokes that we include to our desired amount is zero.

    Then do we something like Knapsack's DP, except we notice that an optimal solution could be arranged so that we never stray beyond [0, 1000], supposing that we start at the desired amount and then add/subtract the distances from there.

    To make it run faster, we implement it using BFS (store the reachable ones in an array that indicated how many steps needed)

»
10 лет назад, скрыть # |
 
Проголосовать: нравится +3 Проголосовать: не нравится

Div2 B take a lot of time debugging.

»
10 лет назад, скрыть # |
 
Проголосовать: нравится +20 Проголосовать: не нравится

"14" it became my worst number because of problem B

»
10 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

Announcement:

Problem B. Weird journey

Note that it is not necessary for good path to go through all cities, we care only about roads.

are announcements supposed to give hints or only to clarify the statement?

»
10 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

And what about div2 B pretest 10?

»
10 лет назад, скрыть # |
 
Проголосовать: нравится +6 Проголосовать: не нравится

How to solve Div2 A ?

»
10 лет назад, скрыть # |
← Rev. 2  
Проголосовать: нравится +39 Проголосовать: не нравится

In Div1 C, I really tried hard to hack O(N^3) solutions. But the CF evaluation server was too fast.. They all worked within 900 ms.

»
10 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

what the data of DIV 2 B test 8?

»
10 лет назад, скрыть # |
 
Проголосовать: нравится +9 Проголосовать: не нравится
»
10 лет назад, скрыть # |
 
Проголосовать: нравится +18 Проголосовать: не нравится

Problem B — Masha and geometric depression It looks like not only geometric who has depression

My Status Right now

»
10 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

I tried to hack a solution with this code

for problem A in Div.2

include

using namespace std; int main() { cout<<100000<<" "<<1<<endl; for(long long i=1;i<=100000;i++) { cout<<10000<<" "; } cout<<endl; }

It says invalid input.Why is it so?

»
10 лет назад, скрыть # |
← Rev. 7  
Проголосовать: нравится -14 Проголосовать: не нравится

[DELETED]

*Thanks for the round

»
10 лет назад, скрыть # |
← Rev. 3  
Проголосовать: нравится 0 Проголосовать: не нравится

int main() { cout<<100000<<" "<<1<<endl; for(long long i=1;i<=100000;i++) { cout<<10000<<" "; } cout<<endl; }

Used this code to Hack a Div.2 A...why do i get invalid?

»
10 лет назад, скрыть # |
 
Проголосовать: нравится +1 Проголосовать: не нравится

I want to see, how many DIV2C solutions will fail due to integer overflow. I managed to hack 4 people in my room alone, who used int ans=0;. My hack test

6
1000000000 0 0 1000000000 1000000000 0

Correct answer: 3000000000

»
10 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

DIV2 B if |b1|>l masha will stop,but you do not say it!

so if |b1|>l && q=0 masha can write 0 ,i think the answer is "inf"! But your question is "0", you did not give me a clear meaning! sorry my english is poor.

»
10 лет назад, скрыть # |
 
Проголосовать: нравится +144 Проголосовать: не нравится

Can I already post "start systests" meme?

»
10 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

How to solve C ? I used two accumulative arrays where in the first array l=1 and in the second array l=2 (r=n in both arrays), then i looked for max range sum of both arrays. this is supposed to be O(n) but still gives TLE on pretest 10. help?

»
10 лет назад, скрыть # |
← Rev. 4  
Проголосовать: нравится 0 Проголосовать: не нравится

For Div 2 B,
Whats the correct answer for :
5 0 4 1
5

Main confusion:
Does abs(b)<=l check happen even if b is a bad number?

»
10 лет назад, скрыть # |
 
Проголосовать: нравится +30 Проголосовать: не нравится

Note that it is not necessary for good path to go through all cities, we care only about roads.

So just a side note, not like the statement says the opposite? Really, why didn't you fix that? "At first, he decided to visit all the cities of his motherland — Uzhlyandia." or any other sentence does not even suggest that he may not want to visit all cities, does it?

Also, don't you guys think that "Boy thinks a path is good if the path goes over m - 2 roads twice, and over the other 2 exactly once." isn't well-defined for M=1? I made them tell me that the answer is 0 for M=1 on my third try.

»
10 лет назад, скрыть # |
 
Проголосовать: нравится +12 Проголосовать: не нравится

I am in doubt, was their any DIV2 round today?

»
10 лет назад, скрыть # |
 
Проголосовать: нравится +23 Проголосовать: не нравится

Спасибо за задачи :) до встречи на всеукре)

»
10 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

can some one help me find out what is the difference between these two codes:

    int n,k;cin>>n>>k;
    ll ans=0;
    for(int i=0;i<n;i++){
        int x;cin>>x;
        ans+=ceil(double(x)/k);
    }
    cout<<ceil(ans/2.0);

and this:

    ll n,k,ans=0,v;
    cin>>n>>k;
    for (int i=0;i<n;i++)
    {
        cin>>v;
        ans+=(v/k);
        if (v%k!=0)
        {
            ans++;
        }
    }
    ans+=(ans%2);
    cout<<ans/2;
»
10 лет назад, скрыть # |
 
Проголосовать: нравится +5 Проголосовать: не нравится

http://codeforces.me/contest/789/submission/25922219 Отличные претесты :)

»
10 лет назад, скрыть # |
 
Проголосовать: нравится +1 Проголосовать: не нравится

TFW you finish debugging 30 seconds after the round ends

feels bad man

»
10 лет назад, скрыть # |
← Rev. 4  
Проголосовать: нравится +3 Проголосовать: не нравится

Can someone tell differences between these codes for Div 2 A?

First one passed pretests and second didn't.

Code 1

cin>>n>>k;
FOR(i,1,n) cin>>arr[i];
long long int sum=0;
for(int =1;i<=n;++i)
	sum+=ceil(arr[i]*1.0/(double)k);
cout<<(long long int)ceil(sum*1.0/2.0)<<endl;

Code 2.

cin>>n>>k;
FOR(i,1,n) cin>>arr[i];
long long int sum=0;
for(int =1;i<=n;++i)
	sum+=ceil(arr[i]*1.0/k);
cout<<ceil(sum*1.0/2.0)<<endl;
»
10 лет назад, скрыть # |
← Rev. 2  
Проголосовать: нравится 0 Проголосовать: не нравится

I think there are some issue in Problem Div2 B. For this reason system test is delayed.

»
10 лет назад, скрыть # |
 
Проголосовать: нравится +2 Проголосовать: не нравится

Systest is still pending, because even the setters get WA 14 on Div2B :)

»
10 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

С упала только потому, что неправильно обработал случай с n = 0(подумал, что в таком случае нам вообще не надо покупать колу и выводил 0). Чо ж вы в семплы его не включили или не написали в условии жирным, что изначально у нас НОЛЬ ЛИТРОВ КОЛЫ И ГАЗА СООТВЕТСТВЕННО. Формально косяк мой, но это же не совсем крайний случай и многие его учли(и я тоже), просто я неверно его обработал.

»
10 лет назад, скрыть # |
 
Проголосовать: нравится +1 Проголосовать: не нравится

Div2.B... 13 is not unlucky number. now, 14 is unlucky number.

»
10 лет назад, скрыть # |
 
Проголосовать: нравится +1 Проголосовать: не нравится

Div2 Problem B Case #14: 123 0 21 4 543453 -123 6 1424

Accepted. But A failed :-/

»
10 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

System test are over but div2 B test doesn't seem correct. 14 test case's ans should be inf but it shows 0

»
10 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

Div2 B : 1221 pretests passed -> 771 AC ..
May God be with us !!

»
10 лет назад, скрыть # |
 
Проголосовать: нравится +5 Проголосовать: не нравится

Div2 B, WA on main test 43 opps :( :(

»
10 лет назад, скрыть # |
 
Проголосовать: нравится +10 Проголосовать: не нравится

even though i am not the only one who dissapointed with problem B, but i do appreciate your effort for giving your time to us for making this contest, i'll wait for your next contest of course with a better problem to be solved, graciass

»
10 лет назад, скрыть # |
← Rev. 3  
Проголосовать: нравится 0 Проголосовать: не нравится

problem B

why output of this case is 0 123 0 21 4 543453 -123 6 1424

it must be "inf" because b1 = 123 will not be printed because it's invalid b2 = 0 will be printed because it's valid b3 = 0 will be printed because it's valid . . . infinity

»
10 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

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

»
10 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

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

»
10 лет назад, скрыть # |
← Rev. 2  
Проголосовать: нравится +3 Проголосовать: не нравится

editorial link is broken edit: fixed

»
10 лет назад, скрыть # |
 
Проголосовать: нравится +5 Проголосовать: не нравится

I don't why but there is some issue with the challenging system near the end of the contenst. It seems that my hack page keeps refreshing and it failed to load the hack interface so I cannot hack other's solution...

Surprisingly after I change from chrome to firefox it suddenly works...Don't know why there is a difference between firefox and chrome...

»
10 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

Happiness is getting into Deep Blue.

»
10 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

System test data for Div-2 problem A are weak. They should test some hack cases too.

»
10 лет назад, скрыть # |
 
Проголосовать: нравится +3 Проголосовать: не нравится

Here is interesting submission of Div2 E/Div1 C. It seems to be O(5004) with some heuristics. I try to find solution using one, two or three types if there is such. If no, then comes what should be O(5004) DP. But it passes systests.

»
10 лет назад, скрыть # |
← Rev. 3  
Проголосовать: нравится 0 Проголосовать: не нравится

Can anyone take a look at THIS submission please? This code gives correct output of the test case 15 on my compiler but wrong ans on codeforces' compiler. Help would be much appreciated. Input case : 3 2 115 16 24 48 12 96 3 720031148 -367712651 -838596957 558177735 -963046495 -313322487 -465018432 -618984128 -607173835 144854086 178041956 .Output should be '1' but on cf it gives me '3'.

»
10 лет назад, скрыть # |
← Rev. 2  
Проголосовать: нравится 0 Проголосовать: не нравится

For part A : I initially submitted 25910962 with variables declared globally and I got wrong answer in test 5. But after that I declared the variables inside the int main() and the solution 25923127 was accepted. Can someone explain it to me how this makes a difference?

»
10 лет назад, скрыть # |
← Rev. 2  
Проголосовать: нравится 0 Проголосовать: не нравится

For B div 2, shouldn't the following test case output in "0" instead of "inf"?

-1000 0 100 1
-1000

because b1 = B, and |b1| > L, she shouldn't write anything on the blackboard.

But I might've missed something. The hack attempt is here: http://codeforces.me/contest/789/hacks/312464

Thanks in advance.

»
10 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

In Div2 Prob B test case 14 — 123 0 21 4 543453 -123 6 1424 The output should be inf because First 123 would not be written on the board as it is greater then 21 but 0 should be written as its not present in the m numbers ,So it should have been written every time. But why is the answer 0..? Answer should have been inf

»
10 лет назад, скрыть # |
 
Проголосовать: нравится +10 Проголосовать: не нравится

Thanks for the great contest!

Very clear description and interesting solutions. Unfortunately, I spent half of the time of the contest trying to figure out why my solution for problem C did not work? In the end, a friend told me that the function f(l, r) = sum_{i=l}^{r — 1} |a[i] — a[i+1]| * (-1)^i-l while I thought it is f(l, r) = sum_{i=l}^{r — 1} |a[i] — a[i+1]| * (-1)^i-1. Anybody else had the same problem?

»
10 лет назад, скрыть # |
 
Проголосовать: нравится +17 Проголосовать: не нравится

I used the following generator code to hack a solution 25904282 for Problem Div2A:

printf("100000 1\n");
for(i=0;i<100000-1;i++)
{
    printf("%d ",10000);
}
printf("%d",10000);
printf("\n");

Unfortunately, the attempt became unsuccessful as the solution produced the output in 998 ms.

Later during the system test, the same solution gave a TLE on the exact same test case — Test Case #27 :(

»
10 лет назад, скрыть # |
← Rev. 2  
Проголосовать: нравится +30 Проголосовать: не нравится

I have an interesting solution for div1 D and maybe it need only O(n) queries.

First we choose a number number G less than , probably (M is the coordinate range and n is the number of lines). And we can random several times to find a point a = (x, y) such that .

Then, for vertical lines, we query all the point (x + kG, y) which is in the coordinate range. And we can find several lines. But if there are many lines which are very close, we may only find out some of them.

So, the next step, we need to find out the remaining lines. If the dis between two adjacent lines is larger than 2G, then there are no lines between them. Otherwise, we can search between these two lines. Each time we query the midpoint of the search range, if we get a new line, then we try to search both sides and otherwise, exit.

We can find out the horizontal lines analogously.

This is my code 25939395.

During the contest, I made some stupid mistakes and failed to pass it. Sad story.