QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#385907#4345. hpmo / 赫露艾斯塔Kevin530720 ✓8ms12772kbC++231.5kb2024-04-11 09:55:162024-04-11 09:55:17

Judging History

你现在查看的是测评时间为 2024-04-11 09:55:17 的历史记录

  • [2024-04-22 04:00:42]
  • 管理员手动重测该提交记录
  • 测评结果:100
  • 用时:162ms
  • 内存:15696kb
  • [2024-04-11 09:55:17]
  • 评测
  • 测评结果:20
  • 用时:8ms
  • 内存:12772kb
  • [2024-04-11 09:55:16]
  • 提交

answer

//Author: Kevin
#include<bits/stdc++.h>
//#pragma GCC optimize("O2")
using namespace std;
#define ll long long
#define ull unsigned ll
#define pb emplace_back
#define mp make_pair
#define ALL(x) (x).begin(),(x).end()
#define rALL(x) (x).rbegin(),(x).rend()
#define srt(x) sort(ALL(x))
#define rev(x) reverse(ALL(x))
#define rsrt(x) sort(rALL(x))
#define sz(x) (int)(x.size())
#define inf 0x3f3f3f3f
#define pii pair<int,int>
#define lb(v,x) (int)(lower_bound(ALL(v),x)-v.begin())
#define ub(v,x) (int)(upper_bound(ALL(v),x)-v.begin())
#define uni(v) v.resize(unique(ALL(v))-v.begin())
#define longer __int128_t
void die(string S){puts(S.c_str());exit(0);}
mt19937_64 rnd(20210448);
ll x[100100],y[100100];
ll A[200200],B[200200],C[200200];
double angle[200200];
int n,m;
vector<int> vec[200200];
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	cin>>n>>m;
	for(int i=1;i<=n;i++)
		cin>>x[i]>>y[i];
	for(int i=1;i<=m;i++)
	{
		cin>>A[i]>>B[i]>>C[i];
		angle[i]=atan2(B[i],A[i]);
	}
	vector<int> key;
	int s=sqrt(n);
	for(int i=1;i<=s+10;i++)
		key.pb(rnd()%n+1);
	srt(key);
	uni(key);
	for(int i=1;i<=m;i++)
	{
		ll mn=1ll*inf*inf;
		int ind=-1;
		for(auto u:key)
		{
			ll dist=x[u]*A[i]+y[u]*B[i]+C[i];
			dist=abs(dist);
			if(dist<mn)
			{
				mn=dist;
				ind=u;
			}
		}
		vec[ind].pb(i);
	}
	for(int i=1;i<=n;i++)
	{
		sort(ALL(vec[i]),[&](const int &a,const int &b){return angle[a]<angle[b];});
		for(auto x:vec[i])
			cout<<x<<'\n';
	}
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 20
Accepted

Test #1:

score: 20
Accepted
time: 7ms
memory: 12632kb

input:

9997 9990
9019266 5863617
-9132512 9933564
-3874637 4993765
444830 -2250447
-2352800 3441144
-6132076 -4919200
-1607690 1649753
-3707230 -9677822
-4044043 949637
-7761530 2069488
9475384 4537713
-6619947 -121926
5929373 653750
5738540 -7373755
1630427 2169595
7049000 185616
-4436632 7644104
-7326158...

output:

3060
9965
1328
9230
9805
9086
3403
4006
3620
3208
4783
2504
5939
4772
2873
9652
3564
9755
4567
7515
9422
1443
1304
5268
7008
6781
627
4504
3158
1091
1959
1255
3148
2547
6951
4063
4264
1226
9221
6407
366
9954
1851
3276
9527
2464
5844
9301
2809
4684
557
5498
1277
5084
622
5407
5900
4499
2056
8460
1298...

result:

ok cost = 2717620

Test #2:

score: 0
Accepted
time: 7ms
memory: 10768kb

input:

10000 10000
-9867885 -6351277
3489722 8586294
-813430 9340951
2086219 9210082
8903276 -6786767
8717742 1297662
8333166 -3317203
7936341 4929952
4912513 9933563
-4537308 -9543067
7319834 8626975
-5937113 -4470138
3427489 -6194898
-7290157 -3404718
-3724079 2294733
7598186 6969998
-9934248 6924016
428...

output:

1907
7090
2721
7527
6591
380
6859
2832
219
8983
4504
5990
8188
7192
3008
7663
6224
2870
7112
7500
7446
7454
9464
5821
4858
7349
3615
6653
8818
4232
8270
1040
6528
1778
3945
2473
1332
2325
1876
5006
338
392
4093
6127
2989
6493
9403
766
6678
7300
9124
1630
4761
4567
4268
8339
6023
3428
764
1134
5
2794...

result:

ok cost = 2737003

Test #3:

score: 0
Accepted
time: 7ms
memory: 10568kb

input:

10000 10000
-660951 65490
-29833 2757177
-340846 10961
-7150119 33459
5136755 4278
25550 775750
5201020 -5199
75169 4666130
67597 1714309
-36541 -3114964
-4240048 31425
73017 2383801
-94770 -836461
7728250 65154
-62043 -9108010
49090 4597522
-6217034 -71671
-6369695 31577
31865 8971451
72473 9040891...

output:

7583
9183
9015
5447
4309
1070
1333
7323
7525
1228
1184
3552
3773
3930
8888
4113
7627
7200
5071
4711
8329
3099
7264
1170
1218
8959
7187
2395
1515
8663
6838
5848
8183
2830
5087
4162
7787
6508
3651
9866
9149
4065
2597
354
1720
2894
4470
2799
7867
4815
6618
8963
9690
4074
212
571
2749
130
4287
8494
2988...

result:

ok cost = 2739829

Test #4:

score: 0
Accepted
time: 8ms
memory: 12636kb

input:

9998 9990
7582 3856200
9459 4381
-5500354 -8064
3998 -8251368
3506 6715096
-8509 -321964
1725 -1322233
5849831 -1846
-5027 1011243
2596 1990975
-9353 -1004281
3956 -604279
8402459 6848
5419 -2187141
8567983 -2494
1683 4015848
-7337 8293412
-7173 7399645
3799 8763972
4228499 -1835
-8493 -2845008
-833...

output:

7069
2337
5376
7878
5049
5652
8577
1429
788
1313
5895
6855
9019
8774
2837
9891
362
5746
7769
6415
5320
4445
7259
2844
4822
1544
8112
4537
231
8793
8388
665
5946
6596
9682
6671
8166
970
3073
368
4312
3939
1474
1867
3002
215
8020
9712
242
6990
8999
186
1768
4776
6045
5016
2349
143
1469
7997
8640
6957
...

result:

ok cost = 2642731

Test #5:

score: 0
Accepted
time: 7ms
memory: 12572kb

input:

10000 10000
-9144786 9458431
9233721 -9868159
-9349753 -9965861
9814616 9358465
9750984 -9543095
-9665224 9051130
9964223 9790510
-9960351 9771782
9534798 9181687
-9569872 -9172559
9221230 -9786591
9879500 9613336
9830155 9270397
-9866671 -9417021
9337577 9481408
9668674 -9921731
-9817467 9225012
99...

output:

4115
4630
6525
2592
5861
9511
811
794
6285
2222
3099
5161
188
4627
3665
2370
6603
941
9205
225
3198
875
4592
2405
158
4931
5954
1796
9431
4053
831
8580
1818
4564
4005
1244
7532
3723
5097
7221
5584
184
3963
7724
4203
1743
3356
9674
8214
9056
6229
2617
3964
8423
4698
5321
8407
5429
6380
154
4469
4646
...

result:

ok cost = 2425213

Test #6:

score: 0
Accepted
time: 2ms
memory: 12596kb

input:

9990 9990
-967949 32827
-1626409 25231
3914913 -17371
-3340636 -33022
-5664776 7967173
-5125 -27879
4988706 -3540854
-9980324 -14749
2914084 -16185
-3231561 9522
1044674 19300
-3619589 16689
1056583 4919512
-141677 -29040
-2587777 -8824
8185554 -10101
-3482427 -1834
8972857 -3639730
-7063435 -8995
2...

output:

9396
9788
3618
4014
9913
3821
7536
4011
8568
6743
7377
4372
454
9214
5784
3096
8439
3131
943
4356
9898
3196
4800
3945
1318
9253
3979
1274
7838
7147
4966
8788
8566
2955
8900
3889
592
8362
5202
9033
936
4292
7409
2154
8071
4559
7107
8064
1253
5102
6791
7058
920
5508
3323
7186
8490
7671
4278
8525
9782
...

result:

ok cost = 2814721

Test #7:

score: 0
Accepted
time: 7ms
memory: 12572kb

input:

10000 10000
1968477 4944613
6286972 -9851737
-6437502 -4770833
1151523 -7901737
-3149643 9687929
-2205837 -376397
-1324393 5174345
3034439 6480824
-9341786 -7611299
8694184 -3435575
95532 -7378553
-428305 -2628108
263 -5693153
4995174 -4874425
-5093158 -5437311
5434124 6700984
-984539 2903531
293896...

output:

82
8747
6402
5863
4423
1990
1810
1333
3213
3786
6177
4513
3192
5776
9598
6378
7085
6771
7575
9056
9683
7508
6671
8690
7528
9048
5952
1788
9075
1195
3984
7580
1968
465
85
6753
7404
7073
9521
3696
2790
9732
6330
309
2737
8922
9471
8869
1594
7305
8180
652
1389
8873
2691
2165
7147
3843
2833
8723
4664
75...

result:

ok cost = 1750612

Test #8:

score: 0
Accepted
time: 7ms
memory: 12772kb

input:

10000 10000
-1326300 -7573500
7443150 -8520425
9706112 5114022
-2518500 -7674600
5016700 630200
9734400 8710400
3048966 -5268394
610442 -1407578
7055300 -101500
616523 3597946
-3141466 6983439
5742991 8144648
5661864 4435109
-2226200 -4249300
-5924600 -9402400
6799900 -3953000
6648000 -8833700
80689...

output:

6529
5716
3896
9180
6730
1567
402
2831
1282
7000
5945
8750
4007
3717
834
8014
516
272
7715
1891
9825
1428
9150
7154
7787
3316
7839
2135
2215
9264
1732
9074
3350
3848
2296
7965
4316
6053
5188
9851
8723
2878
2863
1382
8791
7864
1491
9773
7206
3656
5616
1187
4603
7480
3995
9369
9798
8268
44
7241
4966
6...

result:

ok cost = 2738128

Test #9:

score: 0
Accepted
time: 3ms
memory: 12388kb

input:

10000 10000
-2318095 2019446
-4035918 2985975
713901 -223858
3296173 -824906
-83732 1397407
-316288 128177
-1184337 -2715514
18449 -3918764
482679 -859441
2741883 -4078535
-5781803 1089808
-2596705 -3341805
-3283602 4287650
-204221 2840836
-1521345 -11681
5377933 4075120
-862909 -1012305
-616438 -64...

output:

2071
7002
506
9793
4865
5988
7322
3784
2491
2398
6652
7504
8570
8550
2816
3169
3844
8658
4531
9872
5912
8677
2566
3149
5851
4474
9459
806
9070
7593
4945
7259
2366
4397
4653
966
3279
5805
8656
9478
5049
1706
9020
3262
7120
4916
107
5532
6592
5407
2073
9433
9943
1944
6371
1541
5555
2991
6204
362
9880
...

result:

ok cost = 2742663

Test #10:

score: 0
Accepted
time: 7ms
memory: 12412kb

input:

10000 10000
30399 911905
6099694 -822955
-1970492 1924582
8133655 -2339409
1225483 -1771551
-578009 -1208298
-5626070 5251285
-3033849 -8699056
5626898 3642052
-2037392 -1207307
-6932083 -3926601
7017312 -2624958
-4505258 -3199363
3196125 4153290
5919593 3128640
-5235780 -3147933
-4493757 162244
573...

output:

4214
1862
7545
6143
2165
5491
555
9541
9197
590
6245
1176
4233
1495
8898
7898
8376
3286
9359
682
4801
8910
3926
2664
5743
5790
6436
6623
1435
1133
4762
7960
95
2588
3504
533
7055
7354
3397
3449
9397
6444
1179
4712
5871
493
6599
4111
5341
6499
5294
4855
2317
6539
4268
5736
8815
4035
9269
1166
633
848...

result:

ok cost = 2754387

Subtask #2:

score: 0
Checker Time Limit Exceeded

Test #11:

score: 0
Checker Time Limit Exceeded

input:

100000 200000
-8961334 8961334
-7613572 -7613572
-3090937 3090937
8569374 8569374
-526841 526841
2030109 2030109
829999 -829999
6793124 6793124
-5100765 5100765
-4111697 4111697
5995701 5995701
-3387024 -3387024
1395655 -1395655
1161722 -1161722
7911524 7911524
307563 -307563
1112474 1112474
-131073...

output:

16272
96008
86042
23363
194120
188746
26600
48589
141832
144322
181105
144045
12181
31308
96122
6752
139551
89166
85894
16636
110914
159678
94045
171103
100400
43345
169318
92421
114663
87093
130852
133312
50167
39283
130161
40578
21072
48387
138235
143617
29536
131060
28862
182829
140394
103091
114...

result:


Subtask #3:

score: 0
Skipped

Dependency #1:

100%
Accepted

Dependency #2:

0%