Page 1 of 1

248 - Cutting Corners

Posted: Tue Aug 26, 2014 10:41 pm
by brianfry713
Use this thread to discuss this problem.

Re: 248 - Cutting Corners

Posted: Sat Feb 10, 2018 6:15 pm
by metaphysis
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";
}