QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#761286#8705. 圣遗物dspt15 130ms4676kbC++232.2kb2024-11-18 21:51:442024-11-18 21:51:44

Judging History

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

  • [2024-11-18 21:51:44]
  • 评测
  • 测评结果:15
  • 用时:130ms
  • 内存:4676kb
  • [2024-11-18 21:51:44]
  • 提交

answer

#include <vector>
#include <stdio.h>
#include <algorithm>
using namespace std;
struct point {
    long long x, y; int i, j;
    bool operator < (const point k) { return x != k.x ? x < k.x : y > k.y; }
    long long operator ^ (const point k) const { return x * k.y - y * k.x; }
    point operator + (const point k) { return {x + k.x, y + k.y, i, j}; }
    point operator - (const point k) { return {x - k.x, y - k.y, i, j}; }
} p[500001];

int e[50001], f[50001];
int main()
{
    int h; scanf("%*d%d", &h); while (h--) {
        int n; scanf("%d", &n); point c({0, 0, 0, 0});
        vector<point> d;
        for (int i(1), m; i <= n; ++i)
        {
            scanf("%d", &m);
            for (int j(1); j <= m; ++j)
            {
                double a, b; scanf("%lf%lf", &a, &b);
                p[j] = {int(a * 100), int(b * 100), i, j};
            }
            sort(p + 1, p + m + 1); int t(0), s[11] = {};

            for (int j(1); j <= m; ++j)
            {
                while (t && p[s[t]].y <= p[j].y) --t;
                if (!t || p[s[t]].x < p[j].x) s[++t] = j;
            }
            c = c + p[s[1]]; e[i] = p[s[1]].j; m = t; t = 0;
            for (int j(1); j <= m; ++j)
            {
                while (t > 1 && ((p[s[t - 1]] - p[s[j]]) ^ (p[s[t]] - p[s[j]])) > 0) --t;
                s[++t] = s[j];
            }
            for (int j(t); j > 1; --j) d.push_back(p[s[j]] - p[s[j - 1]]);
        }
        sort(begin(d), end(d), [](const point a, const point b) { return (a ^ b) < 0; } );
        int q; scanf("%d", &q); while (q--) {
            double a, b; scanf("%lf%lf", &a, &b); const int x(a * 100), y(b * 100);
            point g(c); int t(-1); long long s((long long)(x + g.x) * (y + g.y));
            for (int i(0); i < (int)size(d); ++i)
            {
                g = g + d[i];
                if ((long long)(x + g.x) * (y + g.y) > s)
                    s = (long long)(x + g.x) * (y + g.y), t = i;
            }
            for (int i(1); i <= n; ++i) f[i] = e[i];
            for (int i(0); i <= t; ++i) f[d[i].i] = d[i].j;
            for (int i(1); i <= n; ++i) printf("%d ", f[i]);
            putchar('\n');
    }   } return 0;
}

詳細信息

Subtask #1:

score: 15
Accepted

Test #1:

score: 15
Accepted
time: 1ms
memory: 4128kb

input:

1 100
5
3
98 71 28 7 62 13
3
29 23 65 70 34 95
3
59 41 64 43 92 59
3
73 75 99 96 43 2
3
14 24 5 7 54 13
10
8.06 47.73
183.28 351.90
83.70 90.40
34.00 127.83
216.88 312.31
182.09 349.61
266.90 320.28
84.18 420.91
33.26 145.00
118.07 354.22
5
3
25 63 11 75 63 31
3
94 53 38 89 46 23
3
49 99 12 80 52 4
...

output:

1 2 3 2 3 
1 2 3 2 3 
1 2 3 2 3 
1 2 3 2 3 
1 2 3 2 3 
1 2 3 2 3 
1 2 3 2 3 
1 2 3 2 3 
1 2 3 2 3 
1 2 3 2 3 
3 1 1 2 1 
3 1 1 2 1 
3 1 1 2 1 
3 1 1 2 1 
3 1 1 2 1 
3 1 1 2 1 
3 1 1 2 1 
3 1 1 2 1 
3 1 1 2 1 
3 1 1 2 1 
1 3 1 1 2 
1 3 1 1 2 
1 3 1 1 2 
1 2 1 1 2 
1 2 1 1 2 
1 2 1 1 2 
1 3 1 1 2 
1 3...

result:

ok OK, Accepted

Test #2:

score: 15
Accepted
time: 0ms
memory: 3840kb

input:

1 100
5
3
100 44 62 34 64 47
3
9 52 94 73 70 100
3
8 10 87 17 53 61
3
89 88 5 36 2 35
3
76 13 90 71 45 89
10
33.88 69.11
120.74 410.51
119.96 340.70
82.73 416.98
27.98 30.22
69.37 110.99
27.26 153.77
36.29 164.04
56.99 241.65
158.23 272.16
5
3
87 41 60 98 33 50
3
7 83 3 43 78 6
3
88 42 98 97 72 91
3...

output:

1 3 3 1 2 
1 2 3 1 2 
1 2 3 1 2 
1 2 2 1 2 
1 3 3 1 2 
1 3 3 1 2 
1 2 3 1 2 
1 2 3 1 2 
1 2 3 1 2 
1 3 3 1 2 
2 3 2 3 1 
2 3 2 3 1 
2 3 2 3 1 
2 3 2 3 1 
2 3 2 3 1 
2 1 2 3 1 
2 3 2 3 1 
2 1 2 3 1 
2 3 2 3 1 
2 3 2 3 1 
2 3 3 3 3 
2 3 3 3 3 
2 3 3 3 3 
2 3 3 3 3 
2 3 3 3 3 
2 3 3 3 3 
2 3 3 3 3 
2 3...

result:

ok OK, Accepted

Subtask #2:

score: 0
Wrong Answer

Test #3:

score: 0
Wrong Answer
time: 5ms
memory: 3828kb

input:

2 100
27
9
58 21 76 52 99 40 22 25 26 38 25 65 80 47 59 83 12 7
10
87 40 54 90 65 88 86 75 92 22 5 70 53 88 72 34 25 55 7 66
10
8 69 28 19 80 41 17 15 40 82 9 57 77 43 79 63 24 39 62 30
10
38 41 5 45 55 80 93 63 96 46 98 50 31 48 49 49 77 63 46 54
10
99 11 33 21 69 25 9 17 93 30 87 16 22 93 97 36 84...

output:

8 4 8 4 10 10 6 2 6 7 10 6 8 4 10 4 5 6 4 5 9 3 7 7 9 10 2 
3 4 8 4 10 10 6 10 6 7 10 6 8 1 10 4 5 5 4 5 9 3 7 7 9 10 2 
3 4 8 4 10 10 6 10 3 7 10 6 8 1 10 4 5 5 4 5 3 3 7 7 9 5 2 
3 4 8 4 10 10 6 10 3 7 10 6 8 1 10 4 5 5 4 5 3 3 7 7 9 5 2 
3 4 8 4 10 10 6 10 6 7 10 6 8 1 10 4 5 5 4 5 3 3 7 7 9 10 2...

result:

wrong answer Test case #30, Query #1, Your answer is not good enough

Subtask #3:

score: 0
Wrong Answer

Test #6:

score: 0
Wrong Answer
time: 85ms
memory: 3924kb

input:

3 100
496
9
62 33 67 95 25 42 68 17 2 18 65 76 39 78 27 37 55 75
9
97 77 28 91 37 55 83 37 34 82 12 29 58 78 28 6 81 35
8
17 22 2 52 92 14 4 59 82 7 23 37 75 67 39 87
8
62 70 17 5 7 95 84 73 36 35 17 85 84 61 89 69
9
1 80 10 60 37 75 51 64 42 24 89 3 74 56 82 89 87 66
10
79 23 29 19 38 15 14 33 85 1...

output:

2 1 7 8 8 6 3 7 3 6 4 5 1 4 4 1 2 4 3 2 3 2 4 7 8 6 6 3 3 7 1 6 5 2 8 7 2 5 4 2 6 2 2 8 7 9 2 4 4 8 4 6 2 2 7 2 1 3 2 6 7 8 3 1 2 1 8 3 5 7 1 5 5 2 1 7 8 8 7 1 6 3 5 6 4 10 8 7 2 7 4 7 8 3 2 1 2 7 6 4 1 10 7 6 1 5 5 6 4 9 5 9 2 1 3 3 3 1 4 4 3 2 2 5 6 7 1 7 2 3 1 7 4 9 2 9 8 9 5 5 10 8 5 8 4 4 4 9 5...

result:

wrong answer Test case #7, Query #1, Your answer is not good enough

Subtask #4:

score: 0
Wrong Answer

Test #12:

score: 0
Wrong Answer
time: 130ms
memory: 4676kb

input:

4 100
450
10
30.37 69.63 50.77 49.23 94.68 5.32 36.02 63.98 30.92 69.08 60.25 39.75 94.63 5.37 61.38 38.62 91.27 8.73 28.94 71.06
8
74.79 25.21 8.63 91.37 49.25 50.75 27.02 72.98 72.03 27.97 52.44 47.56 41.20 58.80 44.26 55.74
9
58.02 41.98 35.82 64.18 99.61 0.39 59.26 40.74 47.09 52.91 87.65 12.35 ...

output:

1 4 2 6 1 1 5 9 1 3 3 1 1 5 3 4 8 5 5 8 4 3 5 6 8 9 7 3 1 8 9 7 5 1 4 6 7 8 6 7 6 5 9 6 9 5 5 1 3 7 8 6 8 8 9 7 5 3 5 6 7 8 5 8 6 1 8 5 4 7 6 8 8 3 5 6 6 7 3 2 5 3 3 6 4 5 1 1 1 10 4 8 1 3 7 9 4 1 6 7 9 4 5 2 7 8 4 3 9 5 8 9 8 2 9 2 3 2 6 8 9 2 7 4 1 4 1 6 3 6 2 5 7 3 8 10 6 4 6 5 4 3 5 8 1 9 10 9 4...

result:

wrong answer Test case #1, Query #1, Your answer is not good enough

Subtask #5:

score: 0
Wrong Answer

Test #15:

score: 0
Wrong Answer
time: 130ms
memory: 4612kb

input:

5 100
400
9
1.57 81.69 17.89 66.70 65.51 20.96 14.19 70.10 73.04 13.58 25.01 60.09 57.73 28.55 18.21 66.41 41.57 44.34
8
42.15 15.21 45.93 11.16 27.62 30.65 39.90 17.60 9.87 47.93 51.17 5.44 14.72 43.43 42.11 15.26
9
15.72 52.00 32.33 36.33 7.60 59.51 39.83 28.78 58.75 9.42 30.01 38.51 24.14 44.06 0...

output:

1 5 8 6 3 5 8 5 3 9 1 1 3 5 6 6 1 1 7 3 7 2 3 5 1 4 9 2 7 8 7 4 1 8 8 1 2 7 5 3 2 1 7 8 8 8 1 3 2 1 3 10 8 2 5 3 6 4 3 5 10 3 2 5 1 1 2 8 3 3 5 5 6 1 5 2 2 6 3 1 2 2 7 2 6 3 7 5 3 4 3 3 8 6 7 3 5 9 8 9 6 1 1 5 1 3 2 3 6 2 1 8 7 6 3 6 10 5 5 6 9 8 1 6 7 4 3 3 5 6 2 4 9 6 6 3 9 7 6 1 4 2 2 7 9 2 9 9 3...

result:

wrong answer Test case #1, Query #2, Your answer is not good enough