248 - Cutting Corners

All about problems in Volume 2. 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

248 - Cutting Corners

Post by brianfry713 » Tue Aug 26, 2014 10:41 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: 248 - Cutting Corners

Post by metaphysis » Sat Feb 10, 2018 6:15 pm

Test data generator.

Code: Select all

#include <iostream>
#include <cstdlib>
#include <ctime>
#include <vector>

using namespace std;

int main(int argc, char *argv[])
{
    srand(time(NULL));
    
    for (int c = 1; c <= 100; c++)
    {
        int n = rand() % 21;
        cout << n << '\n';
        cout << (rand() % 1000) << ' ' << (rand() % 10) << ' ';
        cout << (rand() % 1000) << ' ' << (990 + rand() % 10) << '\n';
        for (int r = 1; r <= n; r++)
        {
            int x = 10 + rand() % 800, width = rand() % 90 + 1;
            int y = 10 + rand() % 800, height = rand() % 90 + 1;
            cout << x << ' ' << y << ' ' << (x + width) << ' ' << y << ' ';
            cout << x << ' ' << (y + height) << '\n';
        }
    }
    cout << "-1\n";
}

Post Reply

Return to “Volume 2 (200-299)”