QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#625945 | #5426. Drain the Water Tank | stavage | RE | 0ms | 0kb | C++20 | 1.8kb | 2024-10-09 21:58:46 | 2024-10-09 21:58:46 |
answer
#include <bits/stdc++.h>
using namespace std;
int random(int n)
{
return (long long) rand() * rand() % n;
}
map<pair<int, int>, int> mp;
struct Point {
int x, y;
Point(int x = 0, int y = 0) : x(x), y(y) {}
};
typedef Point Vector;
Vector operator+(Vector a, Vector b) { return Vector(a.x + b.x, a.y + b.y); }
Point operator-(Point a, Point b) { return Point(a.x - b.x, a.y - b.y); }
Point operator*(Point a, int p) { return Point(a.x * p, a.y * p); }
Point operator/(Point a, int p) { return Point(a.x / p, a.y / p); }
int sgn(double x)
{
if (fabs(x) < 1e-8) return 0;
if (x < 0) return -1;
return 1;
}
bool operator<(const Point &a, const Point &b) { return a.x < b.x || (a.x == b.x && a.y < b.y); }
bool cmp1(Point a,Point b)
{
if (sgn(atan2(a.y, a.x) - atan2(b.y, b.x)) != 0) return atan2(a.y, a.x) < atan2(b.y, b.x);
return a.x < b.x;
}
Point a[110];
void init()
{
mp.clear();
srand(time(0));
ofstream fout("input.txt");
int n = rand() % 500 + 3;
fout << n << endl;
for (int i = 1; i <= n; i++) {
int x = rand() % 100 - 50;
int y = rand() % 100 - 50;
while (mp[{x, y}]) {
x = rand() % 100 - 50;
y = rand() % 100 - 50;
}
mp[{x, y}] = 1;
a[i] = {x, y};
}
sort(a + 1, a + n + 1,cmp1);
for (int i = 1; i <= n; i++) {
fout << a[i].x << " " << a[i].y << endl;
}
fout.close();
}
int main()
{
for (int i = 0;; i++) {
cout << "test: " << i << endl;
init();
system("good.exe <input.txt> goodout.txt");
system("bad.exe <input.txt> badout.txt");
if (system("fc goodout.txt badout.txt")) {
puts("WA!!");
break;
}
}
// init();
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Dangerous Syscalls
input:
6 0 0 1 1 2 1 3 0 3 2 0 2
output:
test: 0