QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#625945#5426. Drain the Water TankstavageRE 0ms0kbC++201.8kb2024-10-09 21:58:462024-10-09 21:58:46

Judging History

你现在查看的是最新测评结果

  • [2024-10-09 21:58:46]
  • 评测
  • 测评结果:RE
  • 用时:0ms
  • 内存:0kb
  • [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

result: