QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#385901#4345. hpmo / 赫露艾斯塔Kevin530720 123ms13864kbC++231.5kb2024-04-11 09:51:512024-04-11 09:51:52

Judging History

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

  • [2024-04-11 09:51:52]
  • 评测
  • 测评结果:20
  • 用时:123ms
  • 内存:13864kb
  • [2024-04-11 09:51:51]
  • 提交

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];
	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: 3ms
memory: 12276kb

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:

5799
7249
7008
6951
6840
6781
6750
6407
6317
5939
5900
5844
7482
5774
5674
5498
5407
5268
5215
5084
5076
4974
4934
4783
9230
9965
9954
9898
9805
9755
9652
9608
9527
9422
9301
9255
4772
9221
9086
8861
8460
8436
8143
8112
8015
7549
7515
1255
2464
2056
1959
1851
1715
1695
1443
1328
1304
1298
1277
2504
...

result:

ok cost = 49827356

Test #2:

score: 0
Accepted
time: 6ms
memory: 10128kb

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:

6528
7300
7192
7112
7090
6859
6678
6653
6591
7349
6493
6224
6127
6023
5990
5821
5006
4858
8298
9464
9403
9124
8983
8833
8818
8736
8339
4761
8270
8188
7663
7527
7500
7454
7446
1040
2325
1907
1876
1778
1630
1555
1332
1134
2473
867
766
764
392
380
338
219
177
3144
4567
4504
4268
4232
4093
3945
3615
342...

result:

ok cost = 50332784

Test #3:

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

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:

5787
7323
7264
7200
7187
7066
6954
6936
6838
6813
6618
6508
6052
5848
7396
5779
5771
5749
5577
5447
5200
5087
5071
5045
5007
4966
4815
8494
9866
9690
9399
9393
9365
9183
9149
9015
8963
8959
8888
8663
4711
8354
8329
8183
8000
7977
7867
7787
7639
7627
7583
7525
7436
1333
2799
2749
2727
2597
2523
2395
...

result:

ok cost = 49132420

Test #4:

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

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:

6671
7863
7816
7769
7518
7393
7259
7134
7069
6990
6957
6855
6836
7878
6596
6415
6318
6262
6045
5946
5895
5746
5652
5403
5376
5320
8823
9891
9780
9712
9682
9586
9516
9515
9497
9019
8999
8856
8854
5114
8793
8774
8745
8640
8577
8388
8384
8166
8112
8020
7997
7950
930
1667
1544
1543
1474
1469
1429
1313
1...

result:

ok cost = 49713690

Test #5:

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

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:

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

result:

ok cost = 50126721

Test #6:

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

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:

8439
5784
6743
7107
7147
7377
7409
7536
7838
8064
8071
8362
5202
8566
8568
8788
8900
9033
9214
9253
9396
9788
9898
9913
3821
592
936
943
1274
1318
2154
2955
3096
3131
3196
3618
454
3889
3945
3979
4011
4014
4292
4356
4372
4559
4800
4966
6152
7186
7058
7012
6791
6746
6744
6688
6602
6387
6289
7464
6112...

result:

ok cost = 49361740

Test #7:

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

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:

7580
6402
6671
6753
6771
7073
7085
7404
7508
7528
7575
6378
8690
8747
9048
9056
9075
9521
9598
9683
9732
3213
85
465
1195
1333
1788
1810
1968
1990
2790
3192
82
3696
3786
3984
4423
4513
5776
5863
5952
6177
5840
7263
7147
7132
6920
6720
6534
6531
6519
6376
6330
6268
5923
7305
5670
5608
5591
5519
5489
...

result:

ok cost = 50777046

Test #8:

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

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:

6730
7787
7758
7715
7669
7585
7480
7424
7378
7261
7241
7206
7154
7117
7000
7839
6561
6529
6323
6283
6252
6058
6053
5945
5753
5716
5711
5616
5591
5461
8791
9851
9825
9798
9773
9647
9369
9264
9180
9150
9074
9062
9051
9041
8955
5411
8789
8750
8723
8486
8328
8268
8128
8087
8083
8030
8014
7965
7864
884
2...

result:

ok cost = 49915974

Test #9:

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

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:

6652
8007
7811
7690
7593
7523
7504
7322
7259
7120
7002
6662
8134
6592
6371
6204
6082
5988
5912
5851
5805
5610
5555
5532
9294
9992
9943
9887
9880
9875
9872
9793
9604
9478
9459
9433
5407
9070
9020
8724
8677
8658
8656
8570
8550
8500
8389
8229
1541
2991
2816
2566
2491
2398
2366
2073
2071
1944
1706
1589
...

result:

ok cost = 49580905

Test #10:

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

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:

5865
6623
6599
6539
6499
6444
6436
6245
6143
5931
5894
5871
7055
5790
5743
5736
5645
5622
5491
5341
5294
5045
4855
8898
9894
9869
9619
9592
9541
9397
9359
9269
9197
8910
4801
8869
8815
8485
8414
8376
7960
7898
7688
7545
7354
1179
2317
2199
2165
1905
1862
1833
1734
1528
1495
1439
1435
2588
1176
1166
...

result:

ok cost = 49961997

Subtask #2:

score: 0
Wrong Answer

Test #11:

score: 0
Wrong Answer
time: 123ms
memory: 13864kb

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:

130615
128312
128393
129250
129488
129669
130144
130161
130387
128122
130852
131060
131536
132677
133312
133472
134429
134449
125566
121535
122013
122132
122675
123220
124791
125146
125342
134511
125857
126769
127366
127543
127638
127755
127829
128100
141716
139283
139551
139575
140036
140362
140394...

result:

wrong answer cost limit exceeded

Subtask #3:

score: 0
Skipped

Dependency #1:

100%
Accepted

Dependency #2:

0%