308 - Tin Cutter

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

308 - Tin Cutter

Post by brianfry713 » Tue Aug 26, 2014 10:47 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: 308 - Tin Cutter

Post by metaphysis » Sun Feb 11, 2018 4:02 am

Test data generator.

Code: Select all

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

using namespace std;

int main(int argc, char * argv[])
{
    srand(time(NULL));
    
    for (int c = 1; c <= 100; c++)
    {
        int n = 30;
        cout << n << '\n';
        for (int i = 1; i <= n; i++)
        {
            if ((rand() % 2) == 1)
            {
                int x = rand() % 1000, y1 = rand() % 1000, y2 = rand() % 1000;
                while (y2 == y1)
                    y2 = rand() % 1000;
                cout << x << ' ' << y1 << ' ' << x << ' ' << y2 << '\n';
            }
            else
            {
                int y = rand() % 1000, x1 = rand() % 1000, x2 = rand() % 1000;
                while (x2 == x1)
                    x2 = rand() % 1000;
                cout << x1 << ' ' << y << ' ' << x2 << ' ' << y << '\n';
            }
        }
    }
    cout << "0\n";
    return 0;
}

Post Reply

Return to “Volume 3 (300-399)”