QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#385899#4345. hpmo / 赫露艾斯塔Kevin530720 102ms12192kbC++231.5kb2024-04-11 09:49:412024-04-11 09:49:42

Judging History

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

  • [2024-04-11 09:49:42]
  • 评测
  • 测评结果:20
  • 用时:102ms
  • 内存:12192kb
  • [2024-04-11 09:49:41]
  • 提交

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];
			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: 6ms
memory: 10088kb

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:

6779
6879
6875
6854
6850
6847
6832
6825
6809
6798
6895
6766
6759
6738
6737
6732
6723
6720
6712
6966
7005
6997
6993
6992
6978
6977
6976
6972
6967
6689
6938
6936
6931
6930
6927
6920
6916
6899
6454
6496
6495
6489
6484
6483
6481
6467
6457
6456
6508
6448
6435
6426
6387
6384
6374
6371
6357
6605
6688
6675
...

result:

ok cost = 36995919

Test #2:

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

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:

6534
6606
6599
6597
6595
6591
6581
6578
6577
6576
6565
6552
6543
6539
6538
6607
6531
6527
6522
6511
6495
6488
6472
6471
6469
6468
6459
6457
6451
6450
6685
6776
6774
6757
6753
6748
6742
6737
6732
6731
6724
6711
6695
6693
6692
6443
6682
6676
6672
6665
6660
6655
6649
6639
6637
6635
6626
6617
6610
6184
...

result:

ok cost = 37563142

Test #3:

score: 0
Accepted
time: 0ms
memory: 12192kb

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:

6593
6555
6559
6569
6571
6574
6575
6580
6581
6584
6585
6554
6594
6595
6603
6605
6607
6609
6613
6618
6619
6510
6467
6480
6483
6484
6491
6494
6497
6500
6503
6508
6621
6511
6516
6520
6542
6545
6549
6550
6551
6552
6759
6719
6731
6732
6735
6738
6743
6751
6754
6756
6758
6710
6764
6769
6771
6777
6782
6783
...

result:

ok cost = 38864629

Test #4:

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

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:

6657
6626
6628
6631
6636
6639
6641
6644
6646
6654
6621
6659
6661
6662
6664
6667
6670
6673
6684
6601
6566
6569
6571
6574
6578
6583
6589
6593
6599
6685
6603
6608
6609
6611
6612
6613
6615
6616
6805
6779
6781
6783
6785
6787
6788
6798
6799
6802
6768
6807
6810
6816
6817
6818
6822
6831
6832
6731
6687
6688
...

result:

ok cost = 39230704

Test #5:

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

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:

6424
6295
6298
6307
6336
6342
6368
6372
6387
6395
6293
6476
6494
6501
6514
6520
6531
6537
6563
6108
5942
5950
5952
5967
5985
6014
6060
6065
6095
6564
6153
6166
6185
6190
6205
6260
6273
6282
7093
6975
6985
7017
7019
7020
7033
7037
7081
7087
6965
7104
7113
7125
7134
7149
7153
7165
7226
6857
6677
6689
...

result:

ok cost = 44293808

Test #6:

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

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:

6861
7721
7718
7698
7665
7659
7622
7613
7440
7284
7088
7056
6941
6881
7839
6747
6644
6637
6634
6552
6480
6375
6338
6061
6052
6043
5923
9153
9981
9957
9886
9774
9701
9685
9676
9589
9586
9422
9414
9367
9276
5917
9125
9006
8912
8822
8487
8202
8191
8154
8111
8091
7988
7975
1374
2699
2515
2466
2465
2430
...

result:

ok cost = 36870891

Test #7:

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

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:

6653
6767
6744
6739
6720
6713
6680
6673
6672
6776
6631
6622
6613
6605
6589
6586
6568
6560
6849
6964
6943
6937
6936
6920
6880
6864
6856
6559
6834
6826
6823
6816
6812
6810
6806
6805
6257
6330
6324
6323
6319
6315
6298
6297
6275
6336
6250
6246
6245
6244
6239
6236
6235
6234
6433
6550
6525
6514
6490
6482
...

result:

ok cost = 38699257

Test #8:

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

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:

6684
6768
6751
6741
6735
6730
6723
6712
6698
6686
6769
6682
6676
6669
6667
6653
6649
6642
6629
6621
6804
6842
6830
6828
6823
6822
6821
6816
6814
6810
6586
6803
6795
6791
6787
6782
6772
6771
6770
6340
6406
6405
6384
6383
6382
6378
6368
6360
6355
6408
6322
6309
6300
6296
6295
6292
6282
6270
6482
6580
...

result:

ok cost = 37403514

Test #9:

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

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:

6603
6662
6656
6647
6637
6634
6627
6624
6620
6616
6611
6608
6605
6604
6664
6602
6600
6599
6595
6587
6583
6579
6574
6568
6559
6558
6557
6549
6762
6829
6827
6826
6811
6810
6808
6799
6794
6793
6790
6781
6776
6763
6546
6750
6734
6727
6726
6723
6721
6709
6703
6698
6692
6683
6675
6671
6222
6313
6309
6306
...

result:

ok cost = 35994205

Test #10:

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

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:

6663
5986
6003
6020
6108
6244
6335
6621
6642
6650
5948
6708
6766
6791
6829
6844
7003
7031
7037
7323
5473
4726
4764
4780
4841
4871
5240
5256
5285
5375
7543
5484
5633
5676
5685
5743
5851
5873
5900
9287
8879
8886
8962
8977
9027
9072
9081
9183
9195
8781
9379
9728
9819
9866
9893
9899
9949
9981
8221
7725
...

result:

ok cost = 36043128

Subtask #2:

score: 0
Wrong Answer

Test #11:

score: 0
Wrong Answer
time: 102ms
memory: 12036kb

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:

133299
133230
133255
133258
133268
133269
133279
133280
133286
133292
133293
133224
133308
133309
133312
133321
133327
133330
133333
133334
133336
133166
133132
133135
133137
133139
133141
133155
133156
133158
133159
133340
133170
133180
133194
133198
133199
133209
133214
133220
133222
133478
133436...

result:

wrong answer cost limit exceeded

Subtask #3:

score: 0
Skipped

Dependency #1:

100%
Accepted

Dependency #2:

0%