1400 - Ray, Pass me the dishes!

All about problems in Volume 14. If there is a thread about your problem, please use it. If not, create one with its number in the subject.

Moderator: Board moderators

Post Reply
brianfry713
Guru
Posts: 5947
Joined: Thu Sep 01, 2011 9:09 am
Location: San Jose, CA, USA

1400 - Ray, Pass me the dishes!

Post by brianfry713 » Thu Sep 04, 2014 11:32 pm

Use this thread to discuss this problem.
Check input and AC output for thousands of problems on uDebug!

metaphysis
Experienced poster
Posts: 139
Joined: Wed May 18, 2011 3:04 pm

Re: 1400 - Ray, Pass me the dishes!

Post by metaphysis » Sun Jan 13, 2019 4:59 pm

Test data generator.

Code: Select all

#include <bits/stdc++.h>

using namespace std;

int main(int argc, char *argv[])
{
    srand(time(NULL));
    int n = rand() % 490000 + 10000, m = 10000;
    cout << n << ' ' << m << '\n';
    for (int i = 0, sign = 1; i < n; i++)
    {
        if (i) cout << ' ';
        if (rand() % 100 > 80) sign *= -1;
        cout << sign * (rand() % 1000000000);
    }
    cout << '\n';
    for (int i = 0; i < m; i++)
    {
        int s = rand() % n + 1;
        int e;
        if (s == n) e = s;
        else e = s + rand() % (n - s);
        cout << s << ' ' << e << '\n';
    }
    return 0;
}

Post Reply

Return to “Volume 14 (1400-1499)”