Скоро Codeforces Round 1133 (Div. 1, Div. 2)! Регистрация здесь. ×

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

Автор kostka, 7 лет назад, По-английски

I haven't seen any post, so let me announce that the Round E of Google Kick Start 2019 is happening this Sunday (August 25) at 5:00UTC. Get ready and register now at g.co/kickstart.

 .

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

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

Can anyone tell why I am not being able to click the "submit attempt" button even after selecting the language ? Please help.

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

Even I am not able to click the submit button. What is wrong?

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

Not sure if I like this "Results hidden until end of round".

What am I supposed to do with it. Sit arround and ask myself, "Huh, is it really fast enough?"

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

How to solve code-eat switcher? Is it dp or there is some greedy tricks??

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

    That's how I did it:

    Sort the days in decreasing order of eating units.

    Sort slots by the ratio of coding to eating units.

    Initially, use all slots for 100% eating. Days with more required eating units than that, are 'N' obviously.

    Iterating over the days, while our current number of eating units is higher than needed, in the sorted order of slots, exchange the eating into coding (So that we get the highest possible amount of coding units for the needed number of eating units). If possible coding units are greater than required, it's a 'Y'.

    I got WA on large tests though, not sure if because of precision issues, or maybe my solution is actually wrong, is it?

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

when can we submit in practice mode?

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

Can someone please help in finding why my nlogn solution given TLE for (hidden test cases)Code-Eat Switcher.

Question: https://codingcompetitions.withgoogle.com/kickstart/round/0000000000050edb/00000000001707b8

Solution: https://ideone.com/awL83T

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

Problem 2 — Bonus: Solve for exactly (Ai, Bi) rather than at least (Ai,Bi).

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

Quick editorial:

Q1

Spoiler

Q2

Spoiler

Q3 (method 1)

Spoiler

Q3 (method 2)

Spoiler

Codes: https://github.com/AWice/cptraining/tree/master/GoogleKickStart

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

Hello, My handle on google kickstart is by the name "FIREBIRD33". The following is my code for the first problem:

from collections import *
def find(a):
    while a!=l[a]:
        l[a]=l[l[a]]
        a=l[a]
    return a
def printgoogle(a,b):
    print("Case #",a+1,": ",b,sep="")
for _ in range(int(input())):
    n,m=[int(i) for i in input().split()]
    l=[i for i in range(n)]
    # print(l)
    for i in range(m):
        x,y=[int(i) for i in input().split()]
        x-=1
        y-=1
        x,y=find(x),find(y)
        if l[x]>l[y]:x,y=y,x
        l[y]=x
    visited=[False for j in range(n)]
    for j in range(n-1,-1,-1):
        # if not visited[j]:
        l[j]=find(j)
            # visited[j]=True
    # print(l)
    cnt=Counter(l)
    tot=0
    totsame=0
    diff=0
    for i in cnt:
        if cnt[i] > 1:
            tot+=cnt[i]-1
    tot+=(len(cnt)-1)*2
    printgoogle(_,tot)

After the contest ended I submitted the same solution from my competitve submissions and it got accepted for both the test subsets.But during the contest only first test subset was passed.Please look into this!!!!! Thanks!!!

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

Hello, I want to raise an issue towards Google's Test sets.I checked the below submitted solution by a user whose HANDLE is "frextrite" . The third code submitted by this user is accepted by Google but when i debugged it with the below test case it showed TLE. Are google's test case strong enough!!!!!

CODE:

#include <bits/stdc++.h>

#define MAX ll(1e5)

using namespace std;

typedef long long ll;

vector primes(1e9+5, true);

void sieveOfErastosthenes() { for(int i = 2; i <= MAX; i++) { if(primes[i]) { for(int p = 2*i; p <= 1e9; p+=i) { primes[p] = false; } } } }

bool solve(ll x) { ll temp = x; int even_fact = 0; while((temp & 1) == 0) { even_fact++; temp /= 2; }

if(temp == 1) {
    return (even_fact-1 <= 2);
}

return (even_fact == 1) || (even_fact == 2 && primes[temp]) || (even_fact == 0 && primes[temp]);

}

int main() { ios_base::sync_with_stdio(false);

int t;
cin >> t;

sieveOfErastosthenes();

for(int c = 1; c <= t; c++) {
    ll l, r;
    cin >> l >> r;

    int count = 0;
    for(ll i = l; i <= r; i++) {
        if(solve(i)) {
            count++;
        }
    }

    cout << "Case #" << c << ": " << count << "\n";
}

return 0;

}

TEST CASE:

1

1000005 1000020

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

Maybe I am thinking of Code Jam, but didn't the analysis for the round and problems used to be ready very soon after the round?

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

Hi, I'm new to Kick Start. For problem A, I used Kruskal's algorithm to find the cost of minimum spanning tree. I AC the small dataset but I got Runtime Error for large dataset. I have no clue why I got Runtime Error. Could anyone give me a hint? Thanks.

My solution

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

Analysis has been published! You can find the Analysis tab on each problem site.