1342 - That Nice Euler Circuit
Moderator: Board moderators
-
- Guru
- Posts: 5947
- Joined: Thu Sep 01, 2011 9:09 am
- Location: San Jose, CA, USA
1342 - That Nice Euler Circuit
Use this thread to discuss this problem.
Check input and AC output for thousands of problems on uDebug!
-
- Experienced poster
- Posts: 139
- Joined: Wed May 18, 2011 3:04 pm
Re: 1342 - That Nice Euler Circuit
Test data generator.
Code: Select all
#include <iostream>
#include <cstdlib>
#include <ctime>
#include <vector>
#include <algorithm>
using namespace std;
struct point
{
int x, y;
bool operator == (point p)
{
return x == p.x && y == p.y;
}
};
int main(int argc, char *argv[])
{
srand(time(NULL));
for (int c = 1; c <= 25; c++)
{
int N = rand() % 297 + 2;
cout << N << '\n';
vector<point> points;
int vertices = 1;
while (vertices < N)
{
int x = rand() % 300, y = rand() % 300;
if (rand() % 2 == 0) x *= -1;
if (rand() % 2 == 0) y *= -1;
if (find(points.begin(), points.end(), point{x, y}) != points.end()) continue;
if (vertices > 0) cout << ' ';
cout << x << ' ' << y;
points.push_back(point{x, y});
vertices++;
}
cout << ' ' << points.front().x << ' ' << points.front().y << '\n';
}
cout << "0\n";
return 0;
}
metaphysis: http://uhunt.onlinejudge.org/id/95895
My solutions for UVa problems: https://github.com/metaphysis/Code.
My solutions for UVa problems: https://github.com/metaphysis/Code.