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

Автор diskoteka, 4 года назад, По-русски

Привет! В 24.04.2023 17:35 (Московское время) начнётся Codeforces Round 867 (Div. 3) — очередной Codeforces раунд для третьего дивизиона. В этом раунде будет 6-8 задач, которые подобраны по сложности так, чтобы составить интересное соревнование для участников с рейтингами до 1600. Однако все желающие, чей рейтинг 1600 и выше могут зарегистрироваться на раунд вне конкурса.

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

Вам будет предложено 6-8 задач и 2 часа 15 минут на их решение.

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

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

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

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

Спасибо MikeMirzayanov за платформы, а также Vladosiya за координацию нашей работы. Задачи были придуманы и написаны: diskoteka, pavlekn, playerr17, isosto.

Также большое спасибо: pashka, purplesyringa, Alexdat2000, I.Gleb, Insightful, TkachDan, maksimb2008, _--, 74TrAkToR, Gornak40, ut-k8g, Rudro25, Jostic11, yorky, tolbi, AhmetKaan, Splatjov, FiniteMoves, vrintle, KoT_OsKaR за тестирование раунда и весьма полезные замечания.

Всем удачи!

UPD: Разбор задач

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

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

Problem A: find missing space

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

Really excited for this contest. Don't know why.(◠‿◠)

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

as a tester, I can assure that problemset is perfectly balanced , all problems are interesting and I recommend to read all the problems

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

As a participant, I will appreciate the work of authors and testers. Thank you for the contest!

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

As a !non-Tester, I tried to solve problems and give proper feedback. glhf

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

As an author, I wish all <1600 participants getting their free expert this round!

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

this is gonna be my first contest! wahoo!

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

Как одна из тестировщиц раунда хочу сказать, что задачи интересны и приятны. Желаю всем участникам удачи и удовольствия от раунда!

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

As a participant, I will achieve a 4 long streak of losing rating in div3

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

it's not related to this blog :

can some one give me the list or easy to medium problems for DP to kickstart my learning ( like any difficulty wise or something ) for beginner level to medium and you can share any resources or suggestions ....

Thanks in advance!

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

Really excited for this contest. Looking forward to becoming a pupil soon:)

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

How can we be a tester? Plz don't downvote.

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

As a non tester....... how to be tester? (I thought only purple+ can test).

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

The enthusiasm became more in div3 than a short while ago

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

hope to become an expert

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

Give me contribution

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

How to hack a solution during contest?

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

    You can't in div3 or edu rounds. They have their seperate period of time for hacking after the contest.

    But for Div2 you can try that. Just lock the problems and go to room section. And start watching other people solution if you found some counter-testcase hack it.

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

    When the contest ends in some of them there is a phase called: The Open Breaking Phase. And it is in this phase that you must enter someone's solution and press the "Hack!" Soon you are given a choice on how you will hack: with a generator or a manual hack? For the generator you write the code for the test. For a manual one, you write the test by hand. But you can't hack during the contest, only after it.

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

yayyy my first contest!! let's so how it goes

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

Please provide hints and proofs for the problems along with editorials

It helps in upsolving and understanding concepts for beginners instead of directly jumping to solutions :)

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

This is my first round in Codeforces. I really want to get more ratings.

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

hoping for 160 + Delta. feels like mission impossible... xD

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

I'll try my best, wish me luck

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

glhf

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

Hope everyone after this contest will change color:)

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

I've participated in more than 5 rated contests and my rating is <1900 why I'm not in the official standings table?

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

    This is a div 3 contest which is rated only for accounts having less than 1600 rating.Your rating is greater than 1600,so you're not an official participant.

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

      The blog mentioned 1900, right? 2nd bullet in 5th paragraph?

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

        That just mean that your are a trusted participant

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

        You are a participant of the third division if and only if you currently have rating less than 1600. This can be seen in the fact that only < 1600 rated participants are rated in a Div.3 contest.

        If you are a trusted participant of the third division, it is assumed that you must be a participant of the third division (i.e. have rating < 1600). The two constraints are extra for determining if you show up on the official leaderboard.

        Here "do not have a point of 1900 or higher in the rating" means that if you have reached 1900 rating and then dropped back to < 1600 rating, you will not be considered a trusted participant of the third division and you will not show up on the official leaderboard. But the contest will be rated for you.

        You are not a participant of the third division; thus you don't show up on the official leaderboard.

        I agree that the wording is quite unclear.

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

is there anyone else who did not read the problem C properly and just guessed the solution from sample test cases?

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

did g and f leak? Sudden increase in submissions for both

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

When can you submit in practice?

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

How to do G2?

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

Thanks a ton for such a contest. Getting to Expert in style :)

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

Is G2 based on the fact like finding all unique GPs of common ratio upto 30 then doing some trick(no idea) to find GPs of ratio greater than 30 also using the GPs of common ratio upto 30?

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

Finally Expert this time.

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

Such a great contest, really loved it, Problem F was the nicest and cute problem!

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

As a pupil I'm becoming a newbie

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

What was the logic in problem C? I guessed from the test cases.

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

I saw problem E before in codechef but with minimum difference prob

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

Why TLE?

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

    There are two problems here:

    1. a check like mp[v[j]*r] > 0 is relatively costly because it will insert an element into the map if it didn't exist before. It would be better to use map::count() or map::find() to check if an entry is present without modifying the map contents.

    2. you should probably break out of the inner loop when v[j]*r*r is larger than the maximum value in v, otherwise you end up doing 1000×N = 100 million iterations in the worst case.

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

      AC Thanks A Lot. 3900 ms.

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

Problem G1 :

when I use vector freq((int)1e6 + 1);

I got TLE

after replace it with int freq[(int)1e6+1];

I got Acc

How can this happens?? If I use array by luck I got Acc!! it's bad tests

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

A: If a[i]+i-1<=t we can choose the i-th video.

B: First we can choose (i, j) where a[i]*a[j] is the maximum product and remove all other elements. We sort all non-zero elements in a[i] and consider the maximum non-zero product. If there's less than 2 non-zero elements, the answer is 0. If there's 2 non-zero elements, the maximum non-zero product is their product. Otherwise, there must be 2 elements with same sign, and their product will be positive. We need to pick 2 elements with same sign and maximum absolute value to get the maximum product.

C: The answer is (n+1)^2+1 (by looking at examples), but how to prove it? Well, if we change the size of a cinnabon roll from n-1 to n, we need to add 2*n+2 chocolate outside, add 1 chocolate and remove 2 chocolate inside, so we have ans(n)=ans(n-1)+(2*n+1). Therefore we can get answer by induction.

graph explanation

D: First if i>1 and a[i]=n, we have b[i]=(b[i-1]+n)%n=b[i-1], so b[i] cannot be a permutaion, then we have a[1]=n. If n is odd, (n+1)/2 is integer, then we have b[1]=a[1]%n=0, b[n]=(1+2+...+n)%n=(n*(n+1)/2)%n=0, so b[i] cannot be a permutaion. If n is even, let a={n, n-1, 2, n-3, 4, n-5, ...}, then b={0, n-1, 1, n-2, 2, n-3, ...} is a permutaion.

E: If n is odd there's no solution. If there's any char c that there are more than n/2 occurences of c, there's no solution because by the piegonhole principle, there are n/2 pairs of symmetric positions and there are more than n/2 occurences of c, so there must be a pair of positions occupied by c. Otherwise, solution must exist. To calculate the minimum number of operations, let's see what can we do in one operation: For something like ..a..b..|..b..a.. (where '|' denotes the axis of symmetry), we can swap (ba) to turn it into ..a..b..|..a..b.. and remove 2 bad pairs; for something like ..a..b..|..b..c, we can swap (bc) to turn it into ..a..b..|..c..b and remove 1 bad pair. In other words, we can remove 2 different bad pairs or 1 bad pair in one operation. So we can calculate the number of bad pairs of chars from 'a' to 'z' and then we can get the answer.

F: Let ecc[i]=max(1<=j<=n)(dist(i, j)), then the cost of the tree rooted at i is k*ecc[i], and the cost of moving root from 1 to i is c*dist(1, i), so the answer is k*ecc[i]-c*dist(1, i). We can calculate dist(1, i) by BFS, and to find ecc[i] we can find a diameter of the tree, if (u, v) is a diameter, then ecc[i]=max(dist(u, i), dist(v, i)).

G1: The number of good triples where b==1 is sum(cnt[t]*(cnt[t]-1)*(cnt[t]-2)) where t iterate over all values of a[i], so we assume b>=2 for other good triples. For each possible value of k, we can see the maximum possible value of b is not greater than sqrt(a[k]), so the contribution of k is sum(cnt[a[k]/b]*cnt[a[k]/(b*b)]) where 1<=b, b*b<=k. The complexity is O(n*sqrt(A)).

G2: To optimize the solution of G1, we can see that if a[k]/(b*b) is integer, let c=a[k]/(b*b), we have a[k]=b*b*c, then we have b<=cbrt(a[k]) or c<=cbrt(a[k]), so we can find all possible combinations of (b, c) in O(cbrt(a[k])). We can solve the problem in O(n*cbrt(A)) using Hashmap or O(n*log(n)*cbrt(A)) using Treemap for checking cnt[t].

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

global arrays >>>> unordered_map<int, int, custom_hash> :(

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

deleted

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

Can someone explain why my solution to G1 is timing out? https://codeforces.me/contest/1822/submission/203347556

Basically I check all possibilities for the middle element. For each distinct element a, I go through all factors x of a and add up (# of a/x)*(# of a)*(# of xa). This should take O(120n) since each number in [1, 10^6] has <=120 factors, which should pass; however, it TLEs. Can someone help? Thank you.

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

Problem statement C was very hard to understand. At least for me.

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

Небольшие заметки о том, как решать все задачи из этого контеста с ссылками на исходники на C++.

Задача A
Задача B
Задача C
Задача D
Задача E
Задача F
Задача G2

Скопипастил то, что Slamur написал в Telegram-канал:

Задача F от Slamur за линейное время без структур
»
4 года назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

Could someone explain problem D?

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

    There is to cases : n is even or odd, if it is odd the answer will -1, odd numbers will give two same numbers in mod operation so there is no solution, the corner case of odd numbers is 1 because it has legnth 1, the second case : if it is even the answer will begin with n then n-1, and flip between odd and even numbers from 2 and n-3, this is a valid solution like test case 4.

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

      For the case that n is even, I can't figure out the way to assign the permutation with $$$n, n - 1, 2, n - 3, 4,...$$$ like that. Is there any trick to come up with it?

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

        You want to sum up in a way that you go through all remainders $$$mod\, n$$$ exactly once. You have to start with $$$n$$$, otherwise you would not ever have a chance to use $$$n$$$ again, since $$$ (x+n)\, mod\,n = x\, mod\, n $$$. One way I saw to do it was to having two cursors for the remainders $$$l = 0, r = n - 1$$$ and iterating with $$$l$$$ frontwards and $$$r$$$ backwards. For example:$$$ n = 4 $$$, you want to have these remainders $$$\begin{bmatrix} 0,3,1,2\end{bmatrix}$$$, and the construction would be $$$\begin{bmatrix} 4,3,2,1\end{bmatrix}$$$. I'm not exactly sure why this construction works yet, just felt right to me. I'll try to update when I figure it out. my submission

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

I want to ask why the problem G1 my code's time complexity is (2e5*ln1e6) , but I get several times Time Limit Exceed? Can someone help?Thank you very much! This is my code:

#pragma GCC optmize(3)
#pragma GCC optmize(2)
#pragma GCC optmize("Ofast")
#include<bits/stdc++.h>
using namespace std;
typedef pair<int,int>PII;
const int N=1000010,mod=1e9+7;
int a[N],n;
long long c[N];
int b[200010];
void solve()
{
	cin>>n;
	int mx=0;
	for (int i=1;i<=n;i++)
	{
		cin>>b[i];
		c[b[i]]=-1;
		a[b[i]]++;
		mx=max(mx,b[i]);
	}
	long long ans=0;
	for (int i=1;i<=n;i++)
	{
		long long res=0;
		if (c[b[i]]!=-1)
		{
			ans+=c[b[i]];
			continue;
		}
		if (a[b[i]]>=3)
			res=res+(a[b[i]]-1)*(a[b[i]]-2);
		for (int j=2;j<=mx/b[i];j++)
			if (b[i]%j==0)
				res=res+a[b[i]/j]*a[b[i]*j];
		ans+=res;	
		c[b[i]]=res;			
	}
	for (int i=1;i<=n;i++)
		a[b[i]]=0;
	cout<<ans<<'\n';
}
signed main()
{
	cin.tie(0)->sync_with_stdio(false);
	int t=1;
	cin>>t;
	while (t--)
		solve();
}
  • »
    »
    4 года назад, скрыть # ^ |
    ← Rev. 3  
    Проголосовать: нравится 0 Проголосовать: не нравится

    If $$$b = [1000000, 1, 1, ..., 1]$$$, then $$$mx = 1000000$$$ and $$$mx / b[i] = mx$$$ for every $$$b[i] == 1$$$ which means that the inner for loop iterates from 2 to $$$mx$$$ on every iteration. Your complexity is $$$O(n * mx)$$$.

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

      But I have the code' if (c[b[i]]!=-1) continue' to skip the repeat b[i],so every b[i]==1 just can operate one time.

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

        Oh, I missed that line. But the complexity of your code is still at least $$$O(test cases * mx)$$$ though. Consider $$$1e4$$$ test cases of the array $$$b = [1000000, 1]$$$. Your inner for loop would make $$$mx$$$ iterations every time since you are resetting $$$c$$$ in every test case.

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

hacked :(

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

What is the expected rating of problem E?

»
4 года назад, скрыть # |
← Rev. 4  
Проголосовать: нравится 0 Проголосовать: не нравится
  • What is the expected rating of problem E?
  • What is mostly rating range of problem E in Div 3?
  • What is mostly rating range of problem D in div2?
»
4 года назад, скрыть # |
 
Проголосовать: нравится +13 Проголосовать: не нравится

Wonderful div3 round,i learned new things this round.Thanks to problemsetters!

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

Any hint or idea for problem D ?

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

    for i > 1; let a[i] = n; thus, b[i] = (b[i — 1] + n) % n = b[i — 1]; not possible since b is permutation; thus a[1] = n and b[1] = 0;

    if n is odd : b[n] = (n*(n + 1)/2) % n; n + 1 is even; b[n] % n = 0 but b[1] = 0; thus no "-1" if n is even : b[i] — b[i — 1] must be unique; here i think you need to use pen paper to observe or just check the last sample case;

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

Why does G1 has to have so tight constraints I submitted it in python and got that question hacked. Please make it fair for all languages. Atleast try to make in python and c++ many beginners use python.

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

    Actually it's not about python speed. In fact, pypy3 is fast enough to pass this problem. it is because someone generate a special test case to make python code that use dictionary to be TLE.

    You can sort the array before putting them into the dictionary, and it will be accepted. Here is your accepted code: 203372619

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

A rated round should not have had problem F. Its a blatant copy of the general standard problem of finding max distance of a node from each node of a tree. https://cses.fi/problemset/task/1132.

I highly doubt setters were unaware of this since its literally in cses. Please unrate the round in the future before pulling such schenanigans. Contest is not meant to copypaste submission and modify 2- 3 lines to get AC. (I say this as someone who got the problem in under 4 mins due to this exact reason)

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

Could please someone explain why this submission of G2 TLE's

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

My current rating is 401. I've submitted solution of 5 problems of Codeforces Round #867 (Div.3), and all submissions was accepted. a This is my 2nd contest, but still my rating is not increased. Can anyone tell why?

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

To be honest ,I still do not understand Problem C,but just by observing the test cases,I came out to the solution

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

    check out YocyCraft solution above in comments. He's explained it pretty well.

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

    Just add 4n (outer layer), Σ(n-1), Σ(n-2) and 1. You can observe the pattern of the chocolates. But yes, it was decipherable from the test cases.

    On the other hand, I got problem-D AC by guessing the pattern from test cases. Odd numbers dont have solutions, and for even, start by placing n at the beginning, and n/2 in the middle, and on both sides of n/2, place the numbers n-1, n-2, n-3, etc, but in alternating order on left and right sides

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

Is there anyone like me who like Div 2 rounds more than the Div 3 ones?

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

    Yeah, me. I was able to solve A-D in this contest, out of which A,B were very easy, and C,D were guesswork from testcases. I got good rating change, but didnt teach me anything.

    On the other hand, altho I usually lose rating in Div 2 rounds, There's always something I learn, either during the contest or after it.

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

I'm new in contestant in Codeforces. I wanna clear that is Codeforces Round 867 (Div. 3) was a rated contest? I solved two problem(A & C) but my rating/rank is looks like that...

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

This is the first time ever I solve a div3 F instantly. I can't believe that there was a time when I struggle to solve div3 E. It feels pretty amazing

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

no way,i think e is harder than f and g1 XD

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

Hello friends, I have uploaded the video editorial of this contest from A to F. Editorial. If want, You can watch it!!!

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

I feel like problem C and D are just "guess correct solution" problems / see pattern. Is this kind of problems okey for you guys?

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

can i reach expert from current rating of 1529 rank in standings is 1189

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

Hello! I'm kinda new here so please don't be soo critical T_T for the first problem this works fine on my codeblocks but for some reason it gives different outputs when submitted https://codeforces.me/contest/1822/submission/203327103

and what is more confusing is that the output change when I change the variables type from int to ll Can someone please help me T_T

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

I don't know why i am unrated even though it's division 3 and I'm a newbie who participated first contest in Codeforces. can someone explain why for me?

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

    It's not unrated for you. You are just not a trusted participant yet. You need to participate in atleast 5 contests to be a trusted participant. The round will still be rated for you, it's just that you will not be in the official standings for the contest.

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

Is the round unrated? I am below 1600 and have participated in a lot of CF contests, still it is unrated for me, anyone know why?

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

Can someone explain why my code got accepted in the contest, now after system testing it's showing TLE there weren't any pretests as far as I remember.

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

Why I did not get contest rating points despite solving 3 problems?

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

when will my race get updated?

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

when will updated??

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

Pretty bad systests for G2 O(sqrt(a[i])*n*log(n)) with some small constant optimisations is AC

[upd] all hash tables(with custom hash also) instead of map give TL, which is quite funny

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

Has anyone solved Problem F using Rerooting?

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

Can someone hack these solutions? solution1 solution2

They both failed on this test case:

Spoiler

UPD:Thank's pavlekn for hacking them

»
4 года назад, скрыть # |
← Rev. 2  
Проголосовать: нравится 0 Проголосовать: не нравится
#include<bits/stdc++.h>
//#pragma GCC optimize(3)
#define int long long
using namespace std;
const int N=200005;
int a[N],n,T;
map<int,int> mp;
signed main()
{
	ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	cin>>T;
	while(T--)
	{
		cin>>n;
		mp.clear();
		for (int i=1;i<=n;i++)
		{
			cin>>a[i],mp[a[i]]++;
		}
		sort(a+1,a+n+1);
		int ans=0;
		for (auto u : mp)
		{
			int x=u.first,res=u.second;
			ans+=res*(res-1)*(res-2);
			//cout<<x<<" "<<res<<endl;
			if (1*1!=x) ans+=mp[1]*res*mp[x*x];
			for (int b=2;b*b<=x&&b*x<=1e9;b++)
			{
				if (x%b!=0) continue;
				if (mp.count(x/b)&&mp.count(x*b)) ans+=mp[x/b]*res*mp[x*b];
				if (b*b!=x&&mp.count(b)&&mp.count(x*x/b)) ans+=mp[b]*res*mp[x*(x/b)];
			}
		}
		cout<<ans<<endl;
		//cout<<mp.count(2)<<endl;
	}
	return 0;
}

This is my code for problem G2, it got Accepted. But if I use a std::vector to traversal all numbers,it
get TLE 203456289. Why std::vector is so slow and std::map is efficient?

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

For problem F, I only considered one endpoint of the diameter and didn't consider the other one, but it still passed tests. Why does that work? The endpoint I considered was the furthest node from 1.

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

    If you are already on the diameter then the cost to get to the closer end will be <= to the cost to get to the furthest end (and it's obviously optimal to stay on the diameter).

    If you aren't on the diameter every move will change the distance to both ends of the diameter by the same amount until you reach the diameter (at which point you move to the closer end).

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

I think i have used ideone in public mode by mistake and I was absolutely unaware that someone can see my solution there because of which my solution has been copied by somebody/ or it can be an absolute coincidence! Sorry for this but I will take care of it from next time while using ideone. Please have a look into this . MikeMirzayanov . Question F of the recent div3 round caused this issue :( . Please revert back my ratings . 203313670 Submission ID for the question . Please revert back my ratings

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

So my solutions for B and C have been reported as cheating, since they are too similar to others (from https://codeforces.me/profile/KudoConan) B: Mine: https://codeforces.me/contest/1822/submission/203276161 His: https://codeforces.me/contest/1822/submission/203330555 C: Mine: https://codeforces.me/contest/1822/submission/203281804 His: https://codeforces.me/contest/1822/submission/203329843

As you can see they are almost excactly the same. I don't know what to do now, since i have not shared my code with anyone and as you can see my submissions have been an hour before his. Since the solution are very "easy" and there isn't much room for different approaches in Python it feels like there should be a lot of similar solutions for these problems.

Well I guess the only evidence I have is that his A is different from mine and that I also solved D and E, still I am not sure what to do, if there is anything I can provide please let me know.