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

Автор natalina, история, 2 года назад, По-русски

Привет, Codeforces!

В 11.03.2024 17:35 (Московское время) начнётся Codeforces Round 933 (Div. 3).

В этом раунде вам будет предложено 7 задач, посвященных приключениям неугомонного математика, программиста и просто забавного персонажа по имени Рудольф и его брата Бернарда и 2 часа 15 минут на их решение. Задачи подобраны по сложности так, чтобы составить интересное соревнование для участников с рейтингами до 1600. Однако все желающие, чей рейтинг 1600 и выше, могут зарегистрироваться на раунд вне конкурса.

Раунд пройдет по правилам образовательных раундов. Во время раунда задачи будут тестироваться на предварительных тестах, а после раунда будет 12-ти часовая фаза открытых взломов. Мы постарались сделать приличные тесты и тоже будем расстроены, если у многих решения будут падать на взломах после окончания раунда.

Штраф за неверную попытку в этом раунде будет равняться 10 минутам.

Напоминаем, что в таблицу официальных результатов попадут только достоверные участники третьего дивизиона. Это вынужденная мера для борьбы с неспортивным поведением. Для квалификации в качестве достоверного участника третьего дивизиона необходимо:

  • принять участие не менее чем в пяти рейтинговых раундах (и решить в каждом из них хотя бы одну задачу)

  • не иметь в рейтинге точку 1900 или выше.

Независимо от того являетесь вы достоверными участниками третьего дивизиона или нет, если ваш рейтинг менее 1600, то раунд для вас будет рейтинговым.

Составители задач этого раунда: vladmart, Sasha0738, t0rtik, Alexey_Parsh, Mordvin13, daha.002, Vladosiya и natalina.

Также большое спасибо:

  1. Vladosiya и Gornak40 за координацию нашей работы.

  2. MikeMirzayanov за системы Polygon и Codeforces и помощь в подготовке задач.

  3. step_by_step, ashmelev за красное тестирование раунда.

  4. KseniaShk, ibraevdmitriy за жёлтое тестирование раунда.

  5. robotolev, Sochu за фиолетовое тестирование раунда.

  6. dan_dolmatov, JuicyGrape, FBI, AimFar за синее тестирование раунда.

  7. EsraaTaha, Matrosk1n, suborofu, Alenochka, gas за бирюзовое тестирование раунда.

  8. bugrova, Toy_mouse, ringku_ за зеленое тестирование раунда.

Всем удачи!

UPD: Из-за технической сложности (см. пост https://mirror.codeforces.com/blog/entry/126654), временно доступны только следующие C++ компиляторы: C++14 (GCC 6-32) и C++17 (GCC 7-32).

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

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

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

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

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

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

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

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

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

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

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

RAMADAN contest starts 15:35UTC+2. Please

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

do not have a point of 1900 or higher in the rating. So div 2 or div 3 ?

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

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

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

why is there such a big gap (20 days) between 2 contests?? Will more contests be added in between?

UPD: Another contest added

Hopefully more contests gets added up in between.

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

First contest during Ramadan!

I hope the tasks will be interesting

And Good Luck for every parcipicant!

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

Sorry Codeforces, I have to attend night-prayer at that time. so, No contest for me for the next 30 days.

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

I hope to become specialist after this round.

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

"adventures of a restless mathematician"

Mathforces Incoming. Brace yourselves

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

In the last few days, why Div3 contest has been hosted so frequently than before?

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

exciting to become an Expert!

GL everybody :)))

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

I hope to solve as many problems as possible :DD

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

Hope reach pupil after this round

Good luck for everyone !!!!

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

as an old green all i can say is do not be afraid of losing rating

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

Excited to give this contest on my birthday!!!

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

Expert please

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

I wish this contest i could improve the score ! because i have lose four times till now

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

I wish this contest i could improve the score ! because i have lose four times till now

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

Problem E is one of the worst problems i have ever read

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

E has an unusual distance definition and it has not been presented in the russian version for more than half an hour

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

I spent more time in B than problems E and F due to my stupid mistake.

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

bad B, C, D, E, F, G!!!!

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

Binary search doesn't work for F ?

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

My private Screencast.. A,B,C,D,E Video Solutions here: https://www.youtube.com/watch?v=hSNp4xnn9lc

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

Screencast with commentary (set video quality to HD to be able to read my code)

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

Problem G is nice.

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

E seem very hard (at least for me) are there other simple solutions not involving dp with segment tree or sparse table?

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

Can someone explain the 4th test case in problem D.

Like how is it 2 3 5 and not 1 2 3 5?

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

RIP all who got WA on test 2 in F :(

I don't know which case I was missing. Can anyone debug my submission : https://mirror.codeforces.com/contest/1941/submission/250809941

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

Got trolled by problem F (2 wrong submissions) because (a[i] + a[i+1]) / 2 overflows int :(

Let this be a lesson to use std::midpoint... (or in Java, a[i] + (a[i+1] - a[i]) / 2)

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

I could only get TLA on test 3 for F, which trick was needed to reduce complexity ? FFT ?

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

For problem G I made a simple Dijkstra where the cost is determined by the size of a std::set which contains all the colors of the edges I've been through. Does anyone have an idea why it doesn't pass Test 3?

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

Excuse me guys, but who can help me find mistake in D?

My answer is different with correct answer in only one number, and I coulnd't find mistake.

Here is my code:

void solve() {
	int n, m, x;
	cin >> n >> m >> x;
	vector<int> ans;
	int r; char c;
	cin >> r >> c;
	if (c == '0') {
		ans.push_back((x + r)%n + 1);
	} else if (c == '1') {
		int frm = (x-r+n)%n;
		ans.push_back(frm + 1);
	} else if (c == '?') {
		ans.push_back((x + r)%n + 1);
		int frm = (x-r+n)%n;
		ans.push_back(frm + 1);
	}
	for (int i = 0; i < m-1; i ++) {
		cin >> r >> c;
		if (c == '0') {
			for (auto el : ans) {
				el = (el + r)%n + 1;
			}
		} else if (c == '1') {
			for (auto el : ans) {
				int frm = (el-r+n)%n + 1;
				el = frm;
			}
		} else if (c == '?') {
			vector<int> v;
			for (auto el : ans) {
				v.push_back((el + r)%n + 1);
				int frm = (el-r+n)%n + 1;
				v.push_back(frm);
			}
			ans = v;
		}
	}
	set<int> res;
	for (auto i : ans) {
		i --;
		if (i == 0) {
			res.insert(n);
		} else {
			res.insert(i);
		}
	}
	cout << len(res) << nl;
	for (auto i : res) {
		cout << i << " ";
	}
}

I will be very grateful to anyone who offers a helping hand

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

Can anyone give me some insights over the Solution of Problem — F Rudolf and Imbalance

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

    Easy explanation for F :

    Firstly, you can binary search over your answer (you can easily observe monotonicity)

    Let's check if $$$X$$$ can be our answer or not.

    $$$-$$$$$$ \gt $$$ If there is no index such that $$$a_{i+1}$$$ $$$-$$$ $$$a_i$$$ $$$ \gt $$$ $$$X$$$, then surely $$$X$$$ can be our answer.

    $$$-$$$$$$ \gt $$$ If there are more than 1 indexes such that $$$a_{i+1}$$$ $$$-$$$ $$$a_i$$$ $$$ \gt $$$ $$$X$$$, clearly $$$X$$$ can't be our answer.

    $$$-$$$$$$ \gt $$$ Else let's say $$$a_{i+1}$$$ $$$-$$$ $$$a_i$$$ $$$ \gt $$$ $$$X$$$ for some $$$i$$$, what should be the complexity of the extra problem?

    Let's say the complexity is $$$C$$$, then $$$C \leq a_i + X$$$ and $$$C \geq a_{i+1} - X$$$. Thus, we have a range $$$[$$$$$$a_{i+1} - X$$$, $$$a_i + X$$$ $$$]$$$.

    Lastly, we need to check if we could make a problem with complexity in the given range, say $$$[$$$ $$$L$$$ , $$$R$$$ $$$]$$$, for that, you can simply iterate over $$$d$$$ or $$$f$$$ and use set kind of data structure for searching a possible answer.

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

Is there anyone ignore the "consecutive" in problem E like me ._.

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

G was a nice problem

Can't help but point out that C has more ACs than B tho..

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

    Would you please provide a hint regarding your solution to problem G for us mere mortals? Please...

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

      You can create a new graph containing all the nodes and all the colors. On this graph, two nodes have a connecting edge if:

      • One is a node and the other is a colour. Let's call these u and c respectively.

      and

      • There exists an edge on the original graph connected to u and has the color c.

      It's not hard to see that the BFS distance on this new graph is exactly twice the answer :) I don't have a rigorous proof though

      The amount of nodes and edges on this new graph cannot be more than O(n+m) so it will pass in the TL.

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

    what is logic for ** Problem G** .

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

Can't wait to become Expert!

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

I couldn't implement it in time, but I just wanted to make sure my strategy is correct for E.

Let row_ans[r] represent the minimum cost for some row. We can use prefix sums to calculate some contiguous row_ans and choose the minimum in O(n-k) time. The minimum will be the answer.

As for calculating row_ans[r], we use dp to calculate the minimum cost from dp[r][c] to dp[r][m]. row_ans[r] = dp[r][1].

Simmply apply dfs over dp[r][c] and check the minimum cost between dp[r][c] and dp[r][c+1], dp[r][c+2], ..., dp[r][c+d+1].

Is there anything more/wrong?

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

someone tell the approach of PROBLEM D

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

I tried F instead of E as seemed easier but failed on test2.

here's the submission (code is clean)
any help is appreciated.

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

"Note that the penalty for the wrong submission in this round is 10 minutes." Does it mean I can't submit for the next 10 min? or is it anything else?

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

How to do F??Any hints??

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

Is there anyway to solve problem E with memoization? Just curious.

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

Problem A — Simple sort and binary search.

Problem B — Note that 1st element can only be modified by operations on element 2. Accordingly iterate over the array, simulate the operations on each, and check the last 2 elements for 0. In any case, element value goes < 0, answer is not possible.

Problem C — Simple substring search. First, count for mapie (requires only 1 operation). Then check for rest of the possiblities (pie, map).

Problem D — Let dp(i,j) represents whether all the m turns result in player j having the ball, if we are at move i and currently player j has the ball. Do a simple recurive dp, and final answer is the count of dp[i][m] == 1 over all i players.

Problem E — For each row, let dp(i) represent the min. cost to place supports, such that we place a support at a[row][j]. dp(i) can be calculated as min j from i-d-1 to i-1. Use segment tree to speed up this calculation. For every row, cost for that is dp(m). Final answer is a subarray of size k with minimum sum, that can be done using simple prefix sums.

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

Guys fft tag for B wtf?

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

Admit it, who solved B using fft?

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

**Dear Codeforces Community ** Please can anyone tell me why this code give wa on test 2 https://mirror.codeforces.com/contest/1941/submission/250799602

and when i just update the vector size with n+1 and m+1 then it gives me tle on test 6

https://mirror.codeforces.com/contest/1941/submission/250822673

the difference between both the codes is just that instead of using vector of size [n][m] i took [n+1][m+1]??

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

Someone Please answer this python related question regarding problem D. For the input details about m throws, if I take the input as s = input().split(), dist,dir = int(s[0]),s[1] it gets accepted. But during the contest I took it as s = input().rstrip() ,dist,dir = int(s[0]),s[2] (I thought s[1] is the white space?), it gives WA on test 3. Everything else in both the codes is the same. Why is this the case? Can't believe I did not solve a problem because of this :(

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

Similar problems : G and arc061_c

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

How to write tabulation for the following solution to Problem D: 250808686. How do you approach DP in such scenarios?

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

Somebody please tell me if there is a penalty for failed hacking attempt here in this contest.

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

I strongly believe there is something wrong with the Judge for Problem F. This is tourist's submission for F and this is Valee's for F.

I gave the same input to both on ideone. Valee's output doesn't match with the one from tourist. Line 17 of both submissions doesn't match.

So, I submitted this input to hack Valee's submission. It says unsuccessful hack.

I don't understand if I'm doing anything wrong or if the checker is broken.

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

    Code has undefined behaviour due to out-of-bound access-

    int lb = upper_bound(c.begin(), c.end(), (v[src]+v[src-1])/2-b[i])-c.begin();
    sl = min(sl, max(abs(v[src-1]-b[i]-c[lb]), abs(v[src]-b[i]-c[lb])));
    

    This should be —

    int lb = upper_bound(c.begin(), c.end(), (v[src]+v[src-1])/2-b[i])-c.begin();
    if(lb!=k)
        sl = min(sl, max(abs(v[src-1]-b[i]-c[lb]), abs(v[src]-b[i]-c[lb])));
    

    Different compilers behave differently when undefined behaviour happens. If it's working on the judge compiler, I doubt you can hack this submission with the compiler used for this submission.

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

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

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

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

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

Hours and hours trying to solve problem E and the only thing that I discoverd that I'm really bad at dp :))

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

I think there might be an issue with the way codeforces is handling problem B. A lot of people have written solutions which should give a tle and they take forever to run on my local machine. However when i try running hacks here, all hacks fail. In fact there is not a single successful hack in problem B. One such example of a tle solution is https://mirror.codeforces.com/contest/1941/submission/250718192

Please tell me if i am missing something and why none of the hacks give tle on these solutions even though they do on my local machine

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

Ok got it Thanks

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

When will solutions be published?

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

The set of tasks is a bit unbalanced, B is more difficult C and D

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

Why is this test case of problem 2 a "NO" The array should act like this

[5, 6, 0, 2, 3, 0] to

[0, -4, -5, 2, 3, 0] to

[0, 0, 3, 6, 3, 0] to

[0, 0, 0, 0, 0, 0]

Making the answer YES because you can turn the whole array into Zeros.

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

Video Editorial for problem E (Rudolf and K Bridges) : Audio (Hindi)

YOUTUBE EDITORIAL LINK---CLICK here

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

This solution for G naturally came to my mind but my I THOUGHT IT WOULD GIVE TLE. can someone explain why its not getting TLE ? as per my understanding even if the logic is correct , if a node is connected to C different colored edges , this solution would consider that node C times and also once that node would come as minimal it the inner loop will work for E ( no of edges ) times , so according to my understanding worst case should be C * E for minimal output for a single node itself . And it should turn out to be TLE , if you think the time complexity is fine can anyone explain why ?

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

This was a great contest! Great job, problem setters and organizers!

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

can someone explain how this is working in time 250679099

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

    C++ should be considered cheating for this :) In Rust its TLE

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

      So the problem is with codeforces servers?

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

        Here is assembly output of this loop:


        ; for(int i = 1;i<n-1;i++){ cmp rax, 2 jle 414 <_main+0x29d> lea rcx, [8*rax] mov rax, r12 lea rdi, [r12 + rcx - 16] nop ; while(v[i-1] > 0){ mov rdx, qword ptr [rax] test rdx, rdx jle 19 <_main+0x12b> sub qword ptr [rax + 16], rdx ; v[i+1] -=vi_1 ; v[i] -=2; lea rsi, [rdx + rdx] ; vi_1 *= 2 mov qword ptr [rax], 0 ; v[i-1] = 0 sub qword ptr [rax + 8], rsi ; v[i] -= vi_1 add rax, 8 cmp rax, rdi jne -36 <_main+0x110>

        As you can see the inner loop is transformed into 2 SUB commands (one for each element), really cool

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

        Nope, it's due to compiler optimizations. Apparently the compiler rolls the innermost loop into constant-time operations. Optimizations like this do happen sometimes.

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

      I tried rust -O3, and it generates exactly the same thing:

              test    r8d, r8d
              jle     .LBB0_15
              sub     dword ptr [rbx + 4*rax], r8d
              add     r8d, r8d
              sub     dword ptr [rbx + 4*rax - 4], r8d
              mov     dword ptr [rbx + 4*rax - 8], 0
              jmp     .LBB0_15
      

      Not sure why it's TLE on codeforces

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

Can someone explain the solution to E.

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

    Ok.

  • »
    »
    2 года назад, скрыть # ^ |
     
    Проголосовать: нравится 0 Проголосовать: не нравится
    // 1<=t<=1e3 1<=k<=n<=100 3<=m<=2e5 1<=d<=m 0<=ai,j<=1e6 ai,1=ai,m=0 sum(n,m)<=2e5
    #include<bits/stdc++.h>
    #define int long long
    using namespace std;
    const int MAXN=105;
    
    int dp[200001],a[MAXN],hei[200001];
    map<int,int> mp;
    
    signed main(){
    	int t;
    	scanf("%lld",&t);
    	while (t--){
    		int n,m,k,d;
    		scanf("%lld %lld %lld %lld",&n,&m,&k,&d);
    		for (int i=1;i<=n;i++){
    			for (int j=1;j<=m;j++)
    				scanf("%lld",&hei[j]);
    			for (int j=0;j<=m;j++) dp[j]=1e17;
    			mp.clear();
    			dp[1]=1;
    			mp[1]++;
    			for (int j=2;j<=m;j++){
    				dp[j]=mp.begin()->first+hei[j]+1;
    				mp[dp[j]]++;
    				if (j-d-1>=1){
    					mp[dp[j-d-1]]--;
    					if (mp[dp[j-d-1]]==0)
    						mp.erase(mp.lower_bound(dp[j-d-1]));
    				}
    			}
    			// for (int j=2;j<=m;j++)
    			// 	printf("%lld ",dp[j]);
    			// printf("\n");
    			a[i]=dp[m];
    		}
    		int ans=0,sum=0;
    		for (int i=1;i<=k;i++)
    			sum+=a[i];
    		ans=sum;
    		for (int i=2;i+k-1<=n;i++){
    			sum-=a[i-1];
    			sum+=a[i+k-1];
    			ans=min(ans,sum);
    		}
    		printf("%lld\n",ans);
    	}
    
    	return 0;
    }
    
    
»
2 года назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

Is there a reason a_i <= 2*10^9 in F except to screw over participants with overflow...

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

Why I've Rated compete but it didn't Rated?

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

In final scoring of this contest , i have penalty of 125 . how is this calculated ? can someone explain me this.

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

Now since hacking phase is finished, then can someone tell me why this code is not a tle 250786266?

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

Can anyone give me explanation over the Solution of Problem — G. Rudolf and Subway

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

good thank you tester

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

So many solutions of G hacked.

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

Hopefully I'm not the only one doing 0-1 BFS on G ._.

Submitted right after system test initiation so I guess it passed, but I don't trust my messy codes....

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

    how do you apply 0-1 BFS on G ??

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

      (A bit complex though, I tend to overthink stuff.)

      Re-map the entire graph: each vertex of the new graph has the form of $$$(v, c)$$$, with $$$v$$$ is the original vertex, and $$$c$$$ is the color. This is for maintaining the current color in the trip.

      Edge $$$(u, v, c)$$$ in original graph becomes $$$((u, c), (v, c))$$$, and has weight $$$0$$$ (color doesn't changed — if wanna switch, see below).

      For an original vertex $$$v$$$, all vertices $$$(v, i)$$$ are connected to each other through weight-$$$1$$$ edges (acting as interlude steps if wanting to use an edge of new color).

      From here, the core idea for 0-1 BFS is complete.

      Answer will be $$$min \space dist((b, i), (e, j)) + 1$$$ (the $$$dist$$$ denotes the number of color changes, so add $$$1$$$ for the first color).

      If $$$b = e$$$, answer = $$$0$$$ — this case should be trivially handled first.

      A few touches are required:

      • We only considered vertices appearing at least once in the graph, instead of all vertex + color combinations (coz it can go up to $$$4 \cdot 10^{10}$$$). C++'s STL map (or any BST-based map-like data structure) can help with that.
      • To prevent repeated traversals of weight-1 edges, a special visited check is required for each vertex family (i.e. vertices originated from the same original node, differing only in colors).

      My code, for references (but as warned, it was way more than messy): 250907436

      A bit of code explanations and quirks
»
2 года назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

is this contest rated? No rating updates till now?

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

Is this contest rated? No rating changes till now?

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

My rating is 1655 but i'm still a specialist . WHY ?

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

Minor UI glitch post rating change. https://imgur.com/a/mw2YwLz

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

Hello MikeMirzayanov, I received a message saying my solution to 1941E - Rudolf and k Bridges submission 250807913 and singhsoojal solution 250811342 to the problem are quite the same. And thus, we both have been disqualified.

Both Solutions might be very close, but we don't share the same exact code. I didn't share my solution anywhere. We also don't know each others, so we don't have any way to communication.

I think it's unfair to accuse people for cheating just for thinking in the same way and writing codes that are similar but not the same.

Your efforts for making the checker of copying are appreciated but I just figured out it needs some more work.

Thanks for the great round and problems!

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

Your solution 250774158 for the problem 1941F significantly coincides with solutions harshsharma2024/250774158, TLExceeded/250796278, codingishard8/250800925, Fusu/250810532, 2.16/250811985.

Here is my code : Accepted after getting wrong answer with this code : Wrong answer and after 3 minutes from getting the wrong answer. I swear that I didn't cheat in the contest, and all the codes in this contest were written by only me and I didn't use any online IDE.

And I didn't like this Plagiarism Mistake at all, not fair facing like these obstacles to get a new rate, specially when I am too close to the new rate.

MikeMirzayanov I've compared the two solution and I think the similarity between them is normal and many user could do such a solution.

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

Its very funny because a problem from the County Phase of the OI in Romania was similar to the G in this round, and it helped me a lot upsolving this round in the week prior to the contest!

Anyway, interesting problems and round!