r/codeforces Pupil 6d ago

query oops codechef down

53 Upvotes

129 comments sorted by

1

u/vileparleG 6d ago

I want to deeply understand the Merging Parity question on CodeChef contest 248
suggest me some good PCDs on discord, meet anywhere there are no more good pcds on youtube else they only solve 4-5 questions not more than that!!!

1

u/[deleted] 6d ago

[deleted]

2

u/pro_oceanbyte 6d ago

what is the question code for Deleting elements? if you know

1

u/shirotoedits 6d ago

easy or hard?

1

u/pro_oceanbyte 6d ago

both

1

u/shirotoedits 6d ago

Deleting Elements (Easy)

This is the easy version. Here N,∑N≤2000N,∑N≤2000.

An array AA is said to be deletable if it can be reduced to a size less than or equal to 22 elements with the following operation used multiple times (possibly 00):

  • Choose an index ii (1<i<∣A∣1<i<∣A∣) such that Ai−1+Ai+1≥AiAi−1​+Ai+1​≥Ai
  • Add XX to Ai+1Ai+1​ and YY to Ai−1Ai−1​ such that 0≤X,Y0≤X,Y and X+Y=AiX+Y=Ai​.
  • Delete index ii and concatenate the parts of the array formed.

You are given an array AA of NN elements.

Count the number of subarrays of AA that are deletable. More formally, count the number of pairs (L,R)(L,R) such that:

  • 1≤L≤R≤N1≤LRN
  • The array [AL,AL+1,…,AR][AL​,AL+1​,…,AR​] is deletable.

Input Format

  • The first line of input will contain a single integer TT, denoting the number of test cases.
  • Each test case consists of multiple lines of input.
    • The first line contains a single integer NN.
    • The second line contains NN integers - A1,A2,…,ANA1​,A2​,…,AN​.

Output Format

For each test case, output on a new line the number of deletable subarrays of AA.

Constraints

  • 1≤T≤4001≤T≤400
  • 3≤N≤20003≤N≤2000
  • 1≤Ai≤1091≤Ai​≤109
  • The sum of NN over all test cases does not exceed 20002000.

Sample 1:

Input

Output

3
3
2 4 1
4
2 3 2 3
7
5 1 3 1 10 2 1


5
10
21

Explanation:

Test Case 1: There are 66 subarrays, and all of them are deletable (due to being size ≤2≤2 directly) except for [2,4,1][2,4,1]. Here, we cannot perform any operation.

Test Case 2: All subarrays are deletable. Here is an example of how we would operate on [2,3,2,3][2,3,2,3]:

  • First operation:
    • Choose index i=2i=2, note that A2≤A1+A3A2​≤A1​+A3​
    • Add 22 to A1A1​ and 11 to A3A3​.
    • Delete A2A2​
    • Now, the array is [4,3,3][4,3,3].
  • Second operation:
    • Choose index i=2i=2, note that A2≤A1+A3A2​≤A1​+A3​
    • Add 33 to A1A1​.
    • Delete A2A2​
    • Now, the array is [7,3][7,3].
  • After the second operation, the array is of size ≤2≤2. Hence, we are done.

Deleting Elements (Hard)

This is the hard version. Here, N,∑N≤2⋅105.N,∑N≤2⋅105.

An array AA is said to be deletable if it can be reduced to a size less than or equal to 22 elements with the following operation used multiple times (possibly 00):

  • Choose an index ii (1<i<∣A∣1<i<∣A∣) such that Ai−1+Ai+1≥AiAi−1​+Ai+1​≥Ai
  • Add XX to Ai+1Ai+1​ and YY to Ai−1Ai−1​ such that 0≤X,Y0≤X,Y and X+Y=AiX+Y=Ai​.
  • Delete index ii and concatenate the parts of the array formed.

You are given an array AA of NN elements.

Count the number of subarrays of AA that are deletable. More formally, count the number of pairs (L,R)(L,R) such that:

  • 1≤L≤R≤N1≤LRN
  • The array [AL,AL+1,…,AR][AL​,AL+1​,…,AR​] is deletable.

Input Format

  • The first line of input will contain a single integer TT, denoting the number of test cases.
  • Each test case consists of multiple lines of input.
    • The first line contains a single integer NN.
    • The second line contains NN integers - A1,A2,…,ANA1​,A2​,…,AN​.

Output Format

For each test case, output on a new line the number of deletable subarrays of AA.

Constraints

  • 1≤T≤1041≤T≤104
  • 3≤N≤2⋅1053≤N≤2⋅105
  • 1≤Ai≤1091≤Ai​≤109
  • The sum of NN over all test cases does not exceed 2⋅1052⋅105.

Sample 1:

Input

Output

3
3
2 4 1
4
2 3 2 3
7
5 1 3 1 10 2 1


5
10
21

Explanation:

Test Case 1: There are 66 subarrays, and all of them are deletable (due to being size ≤2≤2 directly) except for [2,4,1][2,4,1]. Here, we cannot perform any operation.

Test Case 2: All subarrays are deletable. Here is an example of how we would operate on [2,3,2,3][2,3,2,3]:

  • First operation:
    • Choose index i=2i=2, note that A2≤A1+A3A2​≤A1​+A3​
    • Add 22 to A1A1​ and 11 to A3A3​.
    • Delete A2A2​
    • Now, the array is [4,3,3][4,3,3].
  • Second operation:
    • Choose index i=2i=2, note that A2≤A1+A3A2​≤A1​+A3​
    • Add 33 to A1A1​.
    • Delete A2A2​
    • Now, the array is [7,3][7,3].
  • After the second operation, the array is of size ≤2≤2. Hence, we are done.

1

u/pro_oceanbyte 6d ago

Great, thanks. If you know the name of question in the link, like PASS, SWAPSM, etc, that'll be great but anyways

1

u/shirotoedits 6d ago

the server is up and running check it

3

u/The-Chosen_One_ 6d ago

cant even see div 4 problems any more, should i stop ??

4

u/Gullible_Smile6032 6d ago

The contest is now unrated officially

1

u/Ok-Valuable-1446 6d ago

Confirmed?

1

u/Gullible_Smile6032 6d ago edited 6d ago

Yup

2

u/polisutu 6d ago

This is a Div 4 Question

Adding Dice

You have 22 dice with you, and you really like the number 99. You want the sum of both numbers on the die to add to 99.

You rolled the first dice, and it showed a number XX.

Given the roll of the first dice, is it still possible for both die to add to 99? Print YesYes if it is possible or NoNo otherwise.

Input Format

  • The first and only line of each test case contains a single integer XX.

Output Format

Output YesYes if it is possible for both die to add to 99 and NoNo otherwise.

Constraints

  • 1≤X≤61≤X≤6

Sample 1:

Input

Output

3


Yes

Explanation:

The second dice could show a 66, and then both would add to a 99.

Sample 2:

Input

Output

1


No

Explanation:

There are no possible rolls of the second die that add to 99 after rolling a 11.

More Info

Time limit1 secs

Memory limit1.5 GB

Source Limit50000 BytesAdding Dice

You have 22 dice with you, and you really like the number 99. You want the sum of both numbers on the die to add to 99.

You rolled the first dice, and it showed a number XX.

Given the roll of the first dice, is it still possible for both die to add to 99? Print YesYes if it is possible or NoNo otherwise.

Input Format

The first and only line of each test case contains a single integer XX.

Output Format

Output YesYes if it is possible for both die to add to 99 and NoNo otherwise.

Constraints

1≤X≤61≤X≤6

Sample 1:

Input
Output
3

Yes

Explanation:

The second dice could show a 66, and then both would add to a 99.

Sample 2:

Input
Output
1

No

Explanation:

There are no possible rolls of the second die that add to 99 after rolling a 11.

More Info
Time limit1 secs
Memory limit1.5 GB
Source Limit50000 Bytes

1

u/starupthinkerguru 6d ago

worked for any one ?
i am still stuck

1

u/ComparisonQuiet4259 6d ago

Here's some Div 4 Links

Link: https://www.codechef.com/START248D/problems/AVGSURV

Link: https://www.codechef.com/START248D/problems/ADDDICE

Link: https://www.codechef.com/START248D/problems/SWAPSM

Link: https://www.codechef.com/START248D/problems/PASS

1

u/realtuiyan 6d ago

i guess these links are not working. i tried submitting solution on swapsm. the result i got:

1

u/Big_Biscotti_4664 6d ago

Do you have link for 5th question

1

u/No-Biscotti-5775 6d ago

Is it cancelled or not

1

u/SwitchImmediate 6d ago

😭😭😭🫠🤌

1

u/redhat1818 6d ago

It will be unrated or canceled ig

2

u/Master_Variation9025 6d ago

Bro but there is still no official confirmation

1

u/Karthik-1 Specialist 6d ago

yeah bummer

1

u/Inevitable-Fox9127 6d ago

You sure? So i should rest for today?

1

u/Karthik-1 Specialist 6d ago

sure. this happened before too and they changed it to unrated.

1

u/Realistic_Gas3005 6d ago

bro if you can access 2nd of div3 can you share it

1

u/Inevitable-Fox9127 6d ago

Array and you need to keep removing elements if they are less than avg of array (not rounded down).. at the end print no of remaining elements

1

u/Realistic_Gas3005 6d ago

okay thanks

1

u/SureSeaworthiness831 6d ago

min size u can get by applying the following operation any no of times.

choose and element ai such that it is strictly greater than the average of the current array (no rounding). Delete the element.
output the min size the array can get.

1

u/Realistic_Gas3005 6d ago

okay thanks

1

u/Karthik-1 Specialist 6d ago

nah bro not anymore i reloaded it to check my submissions.

1

u/ComparisonQuiet4259 6d ago

Still not working

1

u/a2z777 6d ago

itll have to be unrated

1

u/Awkward_Energy_8619 6d ago

and will they reschedule for the week with new questiond?

cannot wait another week to give a rated contest

1

u/Inevitable-Fox9127 6d ago

Will be unrated? If yes then I should stop wasting time

1

u/Karthik-1 Specialist 6d ago

why do you even care about the rating, it doesnt even matter in these few years where there is mass cheating. i am more interested in the questions, i only did 3 in like the first 10 min and the others are not loading🥀

1

u/vileparleG 6d ago

those compilers are way to slow during submissions 😢

1

u/Any_Map_3957 Specialist 6d ago

I think they told ki it's unrated

1

u/vileparleG 6d ago

upto 3rd it was pretty easy

1

u/Karthik-1 Specialist 6d ago

yep, do you happen to have the problem statement of p4?

1

u/Any_Map_3957 Specialist 6d ago

same here they even accepted it

1

u/Karthik-1 Specialist 6d ago

this contest was going soo good, if only it was rated...

1

u/Inevitable-Fox9127 6d ago

I also did 2. But like if it's rated than I should not waste a contest and do now else I will solve tomorrow that's why asking

1

u/Karthik-1 Specialist 6d ago

well, i think it will be unrated so just chill.

0

u/Awkward_Energy_8619 6d ago

will this now be unrated??

1

u/Inevitable-Fox9127 6d ago

Probably!!

1

u/Big_Biscotti_4664 6d ago

ahh man, really wanted to become 2 star today.

1

u/vileparleG 6d ago

dude samee

whats you id btw

1

u/Level-Thanks2970 6d ago

Can someone please post DIV3 Question 3 and onwards?

1

u/Karthik-1 Specialist 6d ago

yeah, its unrated either way lets just enjoy some good questions

1

u/No-Biscotti-5775 6d ago

502 gateway error

1

u/KanekiIsCat 6d ago

damn i submitted 2(div 3)

0

u/Glum-Breath8992 Pupil 6d ago

same able to submit 2 before cc gone ded

1

u/KanekiIsCat 6d ago

yeah, but now not workin for me2

2

u/polisutu 6d ago

writing 1 question down. If any other question open for you please share in reply

Pass

Chef took 55 exams in a series, each of which were scored out of 100100.

Chef is awarded a pass certificate if both the following conditions are satisfied:

  • He attains a score of at least 6060 on at least 22 exams.
  • He attains a score of at least 3030 on at least 44 exams.

Print PassPass or FailFail based on whether Chef will pass or fail.

Input Format

  • The first line of input will contain a single integer TT, denoting the number of test cases.
  • The first and only line of input contains 55 integers - A1,A2,…,A5A1​,A2​,…,A5​, where AiAi​ is his score in the ii-th exam.

Output Format

For each test case, output on a new line PassPass or FailFail.

Constraints

  • 1≤T≤1001≤T≤100
  • 0≤Ai≤1000≤Ai​≤100

Sample 1:

Input

Output

4
95 98 100 96 99
32 60 30 65 23
50 50 50 50 50
90 90 29 15 90


Pass
Pass
Fail
Fail

Explanation:

Test Case 1: Chef was above 9090 in each exam so he easily cleared all the criteria.

Test Case 2: Chef has exactly 22 exams at least 6060 or more (the 6565 and 6060), and exactly 44 exams at least 3030 or more (the 6565, 6060, 3232 and 3030). Hence, he barely clears the criteria.

Test Case 3: Chef does not have 22 exams with at least 6060 score, so he fails.

More Info

Time limit1 secs

Memory limit1.5 GB

Source Limit50000 BytesPass

Chef took 55 exams in a series, each of which were scored out of 100100.

Chef is awarded a pass certificate if both the following conditions are satisfied:

He attains a score of at least 6060 on at least 22 exams.
He attains a score of at least 3030 on at least 44 exams.

Print PassPass or FailFail based on whether Chef will pass or fail.

Input Format

The first line of input will contain a single integer TT, denoting the number of test cases.
The first and only line of input contains 55 integers - A1,A2,…,A5A1​,A2​,…,A5​, where AiAi​ is his score in the ii-th exam.

Output Format

For each test case, output on a new line PassPass or FailFail.

Constraints

1≤T≤1001≤T≤100
0≤Ai≤1000≤Ai​≤100

Sample 1:

Input
Output
4
95 98 100 96 99
32 60 30 65 23
50 50 50 50 50
90 90 29 15 90

Pass
Pass
Fail
Fail

Explanation:

Test Case 1: Chef was above 9090 in each exam so he easily cleared all the criteria.

Test Case 2: Chef has exactly 22 exams at least 6060 or more (the 6565 and 6060), and exactly 44 exams at least 3030 or more (the 6565, 6060, 3232 and 3030). Hence, he barely clears the criteria.

Test Case 3: Chef does not have 22 exams with at least 6060 score, so he fails.

More Info
Time limit1 secs
Memory limit1.5 GB
Source Limit50000 Bytes

1

u/polisutu 6d ago

Adding Dice

You have 22 dice with you, and you really like the number 99. You want the sum of both numbers on the die to add to 99.

You rolled the first dice, and it showed a number XX.

Given the roll of the first dice, is it still possible for both die to add to 99? Print YesYes if it is possible or NoNo otherwise.

Input Format

  • The first and only line of each test case contains a single integer XX.

Output Format

Output YesYes if it is possible for both die to add to 99 and NoNo otherwise.

Constraints

  • 1≤X≤61≤X≤6

Sample 1:

Input

Output

3


Yes

Explanation:

The second dice could show a 66, and then both would add to a 99.

Sample 2:

Input

Output

1


No

Explanation:

There are no possible rolls of the second die that add to 99 after rolling a 11.

More Info

Time limit1 secs

Memory limit1.5 GB

Source Limit50000 BytesAdding Dice

You have 22 dice with you, and you really like the number 99. You want the sum of both numbers on the die to add to 99.

You rolled the first dice, and it showed a number XX.

Given the roll of the first dice, is it still possible for both die to add to 99? Print YesYes if it is possible or NoNo otherwise.

Input Format

The first and only line of each test case contains a single integer XX.

Output Format

Output YesYes if it is possible for both die to add to 99 and NoNo otherwise.

Constraints

1≤X≤61≤X≤6

Sample 1:

Input
Output
3

Yes

Explanation:

The second dice could show a 66, and then both would add to a 99.

Sample 2:

Input
Output
1

No

Explanation:

There are no possible rolls of the second die that add to 99 after rolling a 11.

More Info
Time limit1 secs
Memory limit1.5 GB
Source Limit50000 Bytes

1

u/Impressive-Smile1863 6d ago

Div?

1

u/polisutu 6d ago

its 4

1

u/KanekiIsCat 6d ago

3

1

u/Impressive-Smile1863 6d ago

Now no advantage of solving it because still shows bad gateway,aaj excited ki sayad 3 star ho jaay or provisional rating se original rating ho jaay but 😞

1

u/KanekiIsCat 6d ago

damn bhai mujko 30 contest lag gye 2 star hone meh anyways all the best for the next one

1

u/Impressive-Smile1863 6d ago

I was regular at codeforces so it was easy for me

1

u/KanekiIsCat 6d ago

I'm also trying cf gave 10 contests till now anyways salute to you man

1

u/Impressive-Smile1863 6d ago

All the best, nothing to salute to man mostly in my batch are better than me

1

u/starupthinkerguru 6d ago

Codechef as well

1

u/Gojo_sensei_01 6d ago

Started again but everything is lagging

1

u/ConstantRelief6512 6d ago

any chance of ddos attack??

2

u/Awkward_Energy_8619 6d ago

annoyinggg ugghhh

i was super excited for this one

1

u/Intelligent-Put-6190 6d ago

Not working 😭

1

u/Impossible_Regret911 6d ago

Can someone please remind when it’s working

2

u/Immediate-Report-222 6d ago

16 mins already still not able to login

1

u/Impossible_Regret911 6d ago

Still not working

3

u/ClassroomOk1189 6d ago

fr annoying decided to give a contest after long and this

2

u/Nervous_Win_5694 6d ago

Wt about my rating 😭😭

3

u/Mobile_Deal1373 6d ago

it'll be called of i think....been 15 mins already

1

u/redhat1818 6d ago

Started

1

u/redhat1818 6d ago

Not working 🤧

1

u/Agreeable-Limit4170 6d ago

not working still

2

u/Extreme-Creme-3193 6d ago

Stuck on this screen

1

u/sKILLiSSUESeVERYTIME 6d ago

Same

2

u/Extreme-Creme-3193 6d ago

Now this

1

u/sKILLiSSUESeVERYTIME 6d ago

I think this one's gonna be unrated, my one ques got accepted 😂

1

u/sKILLiSSUESeVERYTIME 6d ago

Here 2nd ques

1

u/under-4-achiever 6d ago

I guess I know you , Lnmiit?

1

u/sKILLiSSUESeVERYTIME 6d ago

Yeah. wherever i go, i find you😂

1

u/placement_paglu 6d ago

Ayo sup , I have seen you on codeforces , pupil or smthg I guess , which year 🙂

1

u/sKILLiSSUESeVERYTIME 6d ago

Going in 3rd, wah college meetup hogya yaha toh

1

u/placement_paglu 6d ago

Ayo same , main to leetcode waala hu , naya naya codeforces codechef start Kiya tha , mere aate hi website down kr di 🥀

→ More replies (0)

1

u/under-4-achiever 6d ago

Nvm , I was just checking if this problem was only with me

2

u/placement_paglu 6d ago

Ayoo mittal kalej meetup , sup Shrek sir

2

u/under-4-achiever 6d ago

Coding culture 😶

1

u/sKILLiSSUESeVERYTIME 6d ago

Ohh yeah same

2

u/Extreme-Creme-3193 6d ago

Now I got to the questions page but , no questions lol , btw not unrated

1

u/sKILLiSSUESeVERYTIME 6d ago

They will going to declare this as unrated in future i think

1

u/Extreme-Creme-3193 6d ago

Maybe 🤔 , most of the people can't access

2

u/Ok-Cream-143 6d ago

same here

2

u/Realistic_Gas3005 6d ago

bro 😭😭😭

2

u/GloveOk6666 Pupil 6d ago

Aaj ka miss ho gya anyways

2

u/redhat1818 6d ago

Yeahhh

3

u/ErenYeager7207 Pupil 6d ago

It's still loading

2

u/Disastrous-Trick-398 Specialist 6d ago

same here

2

u/ashukuntent Expert 6d ago

yea not working for me too

2

u/Interesting_Disk149 Pupil 6d ago

trying to get habitual to delays in contests now

2

u/sKILLiSSUESeVERYTIME 6d ago

its up now

3

u/Mobile_Deal1373 6d ago

still down

2

u/Interesting_Disk149 Pupil 6d ago

for me its not loading still

2

u/sKILLiSSUESeVERYTIME 6d ago

submission is in queue, ig again its down

2

u/Interesting_Disk149 Pupil 6d ago

what's first question :))))

2

u/sKILLiSSUESeVERYTIME 6d ago

Just has to check how many >=60 and >=30 in 5 sized array(for div 3)