TsReaper's blog

By TsReaper, history, 15 months ago, In English

Hello Codeforces! The 1st Stage of the 2nd Universal Cup is coming. It will be held from Sept 2nd to 3rd.

The contest is based on an official ICPC Asia East-Continent online first round contest. It has been used in the 2018 ICPC Asia Qingdao Online First Round Programming Contest, which was prepared by the SUA Programming Contest Problem Setter Team.

Problem Setters: shb123, TsReaper, sfiction, zimpha, J.T.J.L..

Testers: chenjb, oipotato, Subconscious

In the 2nd Universal Cup, we have six time windows for participating. You can participate in the contest in the following six time windows:

  • Sept 2nd 13:00 — Sept 2nd 18:00 (UTC +8)
  • Sept 2nd 16:00 — Sept 2nd 21:00 (UTC +8)
  • Sept 2nd 19:00 — Sept 3rd 00:00 (UTC +8)
  • Sept 2nd 21:00 — Sept 3rd 02:00 (UTC +8)
  • Sept 2nd 23:00 — Sept 3rd 04:00 (UTC +8)
  • Sept 3rd 02:00 — Sept 3rd 07:00 (UTC +8)

Contest link: https://contest.ucup.ac

Universal Cup Scoreboard: https://qoj.ac/ucup/scoreboard

About Universal Cup:

Universal Cup is a non-profit organization dedicated to providing trainings for competitive programming teams. Up to now, there are more than 700 teams from all over the world registering for Universal Cup.

A more detailed introduction: https://codeforces.me/blog/entry/118679

Register a new team: https://ucup.ac/register (the registration request will be processed before each stage)

Results of the past stages: https://ucup.ac/results

Terms: https://ucup.ac/terms

Ratings: https://ucup.ac/rating

  • Vote: I like it
  • +78
  • Vote: I do not like it

»
15 months ago, # |
  Vote: I like it -7 Vote: I do not like it

1 hour long queue :)

»
8 months ago, # |
Rev. 2   Vote: I like it 0 Vote: I do not like it

Why this code get accepted (problem j)?

int a, b, c, d, v, t;
    cin >> a >> b >> c >> d >> v >> t;
    int res{}, bf = 0, gf = 0, lst_end = -ign;
    for (int i = 0; bf * a <= t or gf * c <= t; ++i) {
        int newb = bf * a;
        int newg = gf * c;
        if (newb < newg and newb <= t) {
            res += b - (newb > lst_end);
            lst_end = newb + v;
            bf++;
        } else {
            res += d - (newg > lst_end);;
            lst_end = newg + v;
            gf++;
        }
    }
    cout << res;