QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#797862#9856. HelestaquailtyAC ✓184ms9488kbC++23966b2024-12-03 19:55:532024-12-03 19:55:57

Judging History

This is the latest submission verdict.

  • [2024-12-03 19:55:57]
  • Judged
  • Verdict: AC
  • Time: 184ms
  • Memory: 9488kb
  • [2024-12-03 19:55:53]
  • Submitted

answer

#include<bits/stdc++.h>
using namespace std;
int main()
{
    srand(time(NULL));
    vector<pair<int,int>> point;
    int n,m;
    scanf("%d%d",&n,&m);
    for(int i=1;i<=n;i++)
    {
        int x,y;
        scanf("%d%d",&x,&y);
        point.emplace_back(x,y);
    }
    random_shuffle(point.begin(),point.end());
    const int B=min(450,n);
    vector<vector<pair<double,int>>> bucket(B);
    for(int i=1;i<=m;i++)
    {
        int a,b,c;
        scanf("%d%d%d",&a,&b,&c);
        int idx=-1;
        long long val=1e18;
        for (int j=0;j<B;j++)
        {
            long long cur=abs(1LL*a*point[j].first+1LL*b*point[j].second+c-1);
            if(cur<val)val=cur,idx=j;
        }
        assert(idx>=0);
        bucket[idx].emplace_back(atan2(b,a),i);
    }
    for(int i=0;i<B;i++)
    {
        sort(bucket[i].begin(),bucket[i].end());
        for(auto& [ang,idx]:bucket[i])printf("%d\n",idx);
    }
    return 0;
}

这程序好像有点Bug,我给组数据试试?

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 1ms
memory: 4324kb

input:

5 3
2021 700
-9384 1031
2201 2561
4982 6255
-1700 388
-2151 1808 -4359815
-2850 -1980 7147359
-924 217 -8902828

output:

3
2
1

result:

ok AC

Test #2:

score: 0
Accepted
time: 173ms
memory: 9020kb

input:

100000 200000
-5642 9654
1394 4117
-6066 1661
-3991 2756
-6382 -3741
9180 1103
6435 8264
3095 9568
2536 -9040
-8582 4659
-4267 4026
6970 7719
-18 2646
3186 2191
6062 8223
-213 -677
9060 -803
-9909 3809
6932 -4943
-4656 -1576
-8348 8637
-8142 384
387 6528
-8917 2493
-7735 563
3179 4196
2667 -6339
912...

output:

199690
6295
190969
154395
53836
32321
147776
64512
60785
137353
81595
10015
113059
56436
31189
32268
124888
137591
1377
30367
117820
104530
62579
120396
32275
84611
41523
7086
100253
171479
106595
53427
50398
16914
197703
145049
96856
131205
20834
51267
149410
98043
171046
13754
118283
132679
76404
...

result:

ok AC

Test #3:

score: 0
Accepted
time: 169ms
memory: 8760kb

input:

100000 200000
-8437 -7348
-3691 9188
6539 6088
2831 -8589
9456 -5726
1342 -9920
-7417 -4595
-9751 -8635
-873 6276
-7677 6139
2108 7571
8235 -2676
-9099 9300
-7409 327
9678 6292
-4789 5183
-9310 -9638
1386 -7700
-3861 -4932
-6448 -6373
4582 634
9540 9230
2292 -8900
6775 5777
-6193 7373
-3984 -2402
72...

output:

65988
41508
155405
70810
120886
80200
43147
158844
86141
87937
130044
96632
129707
145149
151534
193570
25766
94023
189637
80484
94327
74694
43428
184418
154226
174501
27858
166441
127332
184357
105561
156290
198083
9091
80036
113752
182380
33590
89597
104356
180899
788
194727
29701
19174
26934
6957...

result:

ok AC

Test #4:

score: 0
Accepted
time: 181ms
memory: 9172kb

input:

100000 200000
26 4743
-78 8872
994 51
41 -5788
-9717 -61
-87 -7939
6568 27
47 7664
-42 5169
43 6958
8453 -40
-77 -779
9 -9251
69 5559
6758 78
64 8381
-16 -6910
5140 77
-2180 77
58 -8958
-1 3493
54 -4585
-6353 31
-263 -5
80 -624
76 -9560
43 1013
7666 -21
-64 -1026
-3874 -43
511 -9
55 -8760
-9989 79
8...

output:

70670
180785
188005
144693
174255
40816
104822
53536
108760
83932
50120
178448
173370
90677
193307
1982
182186
85522
63603
156972
192130
76213
147949
182402
138708
58214
84312
187291
97222
156611
112408
116252
74194
10213
122121
73236
109370
197956
89393
174529
90666
55869
82747
59758
134302
93470
1...

result:

ok AC

Test #5:

score: 0
Accepted
time: 179ms
memory: 9268kb

input:

100000 200000
4 6274
8031 0
-5 9161
-2379 -2
-8808 5
5 -4096
-3209 -2
-522 0
7817 6
-5406 1
9916 -1
-1065 -8
3 -6659
6664 6
-6574 -3
4935 2
-2581 3
-9 1405
-3 3085
-2386 3
9 -7389
7215 -9
3358 3
527 -1
7 -2977
9325 -3
-5 456
-9416 5
-6 4058
5565 -7
-5 9472
2 -6975
4031 -8
2612 5
4 2119
8 2465
1823 -...

output:

60243
36576
118639
48745
43049
177783
112301
131910
79332
24692
143406
136063
186748
127370
173333
180407
86645
28869
135393
84610
103028
18391
125095
97765
181699
187888
8022
71006
36548
158007
97481
198160
95695
128505
73000
125387
56672
105979
180249
51546
81874
143483
50202
107309
192122
3776
17...

result:

ok AC

Test #6:

score: 0
Accepted
time: 179ms
memory: 9120kb

input:

99991 199995
9632 -9739
-9421 9672
-9692 9056
9838 9988
-9667 -9044
9865 9226
-9274 9909
-9743 9487
-9859 9511
9029 -9855
9259 9031
-9479 9858
-9327 9349
-9842 9612
9486 9398
-9425 9607
9266 -9573
9355 -9362
-9086 -9565
-9348 9282
9341 9361
-9572 -9119
9867 -9398
-9818 -9118
-9863 9330
-9524 -9919
-...

output:

178582
74868
23617
46076
97329
26634
66500
75661
25545
172106
156850
182806
47847
69405
101517
22346
29243
148658
197740
14844
30096
180032
36900
84916
49963
191800
125117
36381
151255
140591
92566
186717
139296
169402
24916
148111
191422
113886
101885
43020
156440
34744
11526
43638
83065
102666
887...

result:

ok AC

Test #7:

score: 0
Accepted
time: 176ms
memory: 9064kb

input:

100000 200000
3887 -5
-5113 -1969
-8808 33
-6748 -27
-5390 -27
-5387 19
-6993 23
5519 5147
3891 11
4024 -12
-483 10
-1802 -3223
-4441 -16
-7073 32
5063 -1
-3620 -26
66 17
-5079 13
9255 -16
3245 -5597
-2504 26
3449 15
3970 -2
6479 -14
5046 10
-5522 -2739
6557 -4447
9344 -10
-9121 8551
-5534 1
3025 -2...

output:

15148
26319
118927
133042
89611
90497
69945
183916
3630
91073
181618
19705
180098
197838
92314
105660
190246
79159
158314
176630
121448
113740
81955
196765
54877
186644
139505
159091
126955
36236
124764
107615
6268
80674
184208
185578
143853
121332
143770
117621
9180
80552
77882
153580
70210
38653
8...

result:

ok AC

Test #8:

score: 0
Accepted
time: 180ms
memory: 9488kb

input:

99999 199992
-5430 -3718
2301 5165
3773 2966
8555 3275
5084 -1742
5596 8195
-5538 8220
483 -9102
-2441 1360
1152 -4918
-8823 6642
1118 -7300
-3249 -5416
-3647 6637
-1235 -4121
-906 5967
-3806 -866
-40 9387
-7370 -7783
-1762 8538
3605 8324
1796 4470
5719 -4374
4412 -1178
-9062 7592
-7382 1257
-6183 -...

output:

172118
176420
120918
1789
154362
119304
172811
32870
106181
38027
165864
37179
39792
99419
69940
73209
74266
120812
110054
3301
70478
81195
123921
131223
194959
84179
49611
6042
9647
160302
177805
167096
103074
15027
47914
137929
74292
148311
174724
162016
183544
91428
161029
58641
151581
166549
115...

result:

ok AC

Test #9:

score: 0
Accepted
time: 184ms
memory: 8712kb

input:

100000 200000
-1102 -145
-1500 4700
-7900 1800
-6826 -2965
-7238 -6458
-1573 2724
7747 8463
-100 -5500
2673 -9396
9455 964
-6200 4000
5904 6047
-500 -1500
8200 -200
-5400 -5400
-2800 -5400
5300 5000
8085 -6750
-9200 5000
-3400 5700
5536 4920
-1800 -4400
8445 1087
-4900 1000
2146 9329
-3251 -667
9792...

output:

46948
149474
92155
23981
58726
82161
41232
26080
38121
64047
166352
159935
150142
4645
76439
45211
33631
79340
197344
113850
132182
179460
40716
107456
79629
167668
143728
4344
34906
38984
113710
51183
176870
74270
157197
170631
51827
199212
139070
93360
108789
142465
121710
9996
153168
89276
145233...

result:

ok AC

Test #10:

score: 0
Accepted
time: 181ms
memory: 8800kb

input:

99991 199991
2325 -2920
692 -152
-251 318
1881 866
-2854 -3203
6342 5970
1434 -112
-2439 -3988
5426 -2034
1457 4393
3369 -3539
310 614
4722 2424
3368 -3285
645 1321
759 -1051
-2529 -4287
-675 2659
-1176 5344
-2233 -1109
2866 -1038
-3540 1478
-2154 211
-2599 -1625
-8134 2178
-7107 5194
-363 6721
4595...

output:

72160
9562
41720
7244
183533
30679
31731
116096
51789
109651
29249
165467
182321
152666
70675
193515
163350
44716
122387
25651
134929
113130
155758
32590
170471
150729
70990
128910
9117
28100
1270
49488
86041
101936
123644
29753
67187
24531
119834
131674
112027
175376
22232
158413
14284
117799
17780...

result:

ok AC

Test #11:

score: 0
Accepted
time: 177ms
memory: 8616kb

input:

100000 200000
-1446 1521
2479 5055
2702 1520
1047 -9233
-3285 1234
1205 6386
-6050 -5912
4305 1444
7151 5691
3860 -361
2149 4468
-4270 -2345
-5032 3222
6410 -785
-2731 -2957
1814 2793
1090 -4792
-463 -475
-7010 -1745
7143 5780
7681 -1864
-1971 5157
-6756 1817
-4554 1590
416 -5565
2026 645
-4290 -750...

output:

68205
57095
51452
102570
31221
116813
149288
4253
122055
18806
108282
199492
120516
126838
23366
127363
23280
153373
23890
67936
181532
8040
162352
164412
175577
38750
49187
99442
135506
33262
57290
194871
127851
25118
180837
161179
26928
87045
179561
12830
16105
174207
52664
35055
157010
109403
144...

result:

ok AC

Extra Test:

score: 0
Extra Test Passed