QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#224945#4345. hpmo / 赫露艾斯塔Nahidameow20 428ms22316kbC++232.4kb2023-10-23 18:13:342023-10-23 18:13:35

Judging History

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

  • [2023-10-23 18:13:35]
  • 评测
  • 测评结果:20
  • 用时:428ms
  • 内存:22316kb
  • [2023-10-23 18:13:34]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pd push_back
#define all(x) x.begin(),x.end()
//==============================================================
ll QP(ll x,ll y,ll mod){ll ans=1;for(;y;y>>=1,x=x*x%mod)if(y&1)ans=ans*x%mod;return ans;}
ll inv(ll x,ll mod){return QP(x,mod-2,mod);}
//==============================================================
namespace IO{
	int readInt(){
		int x=0,y=0;char c=0;
		while(!isdigit(c))y|=c=='-',c=getchar();
		while(isdigit(c))x=(x<<3)+(x<<1)+(c^48),c=getchar();
		return !y?x:-x;
	}
}
template<typename T> struct MyVector{
	vector<T> v;
	MyVector(){}
	MyVector(auto _v){v=_v;}
	//============================================================
	T operator [](const int &i)const{
		if(i>=v.size())return 0;
		return v[i];
	}
	T &operator [](const int &i){
		if(i>=v.size())v.resize(i+1);
		return v[i];
	}
	void operator += (MyVector<T> P){
		for(auto y:P)v.pd(y);
	}
	//============================================================
	unsigned int size(){return v.size();}
	bool empty(){return v.empty();}
	void resize(int k){v.resize(k);}
	void clear(){vector<T>().swap((*this).v);}
	//============================================================
	void push_back(const T &x){v.pd(x);}
	void pop_back(){v.pop_back();}
	void push_front(const T &x){v.insert(v.begin(),x);}
	void pop_front(){v.erase(v.begin());}
	//============================================================
	auto begin(){return v.begin();}
	auto end(){return v.end();}
	auto back(){return v.back();}
	//============================================================
	//void debug(){printf("Debug:");for(auto y:v)printf("%lld ",y);puts("");}
};
//===============================================================
const int N=5e5+10;
int n,m,per[N];
pair<int,int> p[N];
vector<pair<double,int> > v[N]; 
int main(){
	//freopen(".in","r",stdin);
	//freopen(".out","w",stdout);
	scanf("%d%d",&n,&m);
	for(int i=1;i<=n;i++)scanf("%d%d",&p[i].first,&p[i].second),per[i]=i;
	int Blk=min(500,n);
	random_shuffle(per+1,per+n+1);
	for(int i=1;i<=m;i++){
		int A,B,C;scanf("%d%d%d",&A,&B,&C);
		int pos=0;ll ans=0;
		for(int j=1;j<=Blk;j++){
			ll S=A*p[per[j]].first+B*p[per[j]].second+C;
			if(S>0){
				if(!pos||S<ans)ans=S,pos=j;
			}
		}if(!pos)pos=1;
		v[pos].pd({atan2(A,B),i});
	}
	for(int i=1;i<=Blk;i++){
		sort(all(v[i]));
		for(auto y:v[i])
			printf("%d ",y.second);
	}
	return 0;
}


Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 20
Accepted

Test #1:

score: 20
Accepted
time: 26ms
memory: 19976kb

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:

5755 7198 3430 3047 25 1106 4007 6948 8766 7474 3783 1389 2871 3408 3474 4055 4295 8839 9116 4121 4429 5741 7365 8356 9871 2051 3247 6049 8964 7792 5380 471 2608 3709 6158 9703 32 65 353 388 460 977 1187 1234 1414 1590 1849 1954 2187 2231 2303 2367 2592 2722 2763 2869 2960 3030 3411 3473 3486 3781 3...

result:

ok cost = 11427425

Test #2:

score: 0
Accepted
time: 22ms
memory: 18028kb

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:

8061 971 3137 3931 8974 8169 8209 4094 5519 8757 1366 2803 4052 768 7780 4419 5886 6177 7429 7786 1085 2969 3419 4642 4919 5629 6206 6457 7645 8573 9082 9820 9860 8352 5312 85 2669 4892 6451 7171 2395 7952 3752 9157 1136 3644 9018 5123 2760 12 49 395 456 457 560 597 619 662 692 702 960 999 1121 1198...

result:

ok cost = 11348616

Test #3:

score: 0
Accepted
time: 23ms
memory: 20028kb

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:

9314 4766 5956 6096 9806 5506 9110 8388 9354 1435 3066 6286 7762 9472 585 2814 2987 5399 5549 8802 7560 7364 413 828 1419 1454 1521 3451 5415 5552 5642 5675 5677 6716 7358 7859 7863 8806 8813 8822 9229 9458 9490 9810 9908 9151 1091 3205 652 1566 4719 5486 7092 7435 8675 274 2701 7349 9414 6435 6837 ...

result:

ok cost = 11285060

Test #4:

score: 0
Accepted
time: 22ms
memory: 18796kb

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:

7964 8760 9623 1748 5627 2872 585 3878 4017 7425 1805 4055 8675 170 5806 1209 3900 3218 8303 5893 616 6207 555 927 1050 1051 2184 2635 4074 4232 4368 4484 4781 5026 5326 6579 6814 6964 7384 7668 7851 9826 6870 1699 3160 391 9644 6215 2387 7617 1189 1844 506 2998 6255 6592 9695 949 1825 2096 4234 895...

result:

ok cost = 10747396

Test #5:

score: 0
Accepted
time: 21ms
memory: 20100kb

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:

4717 8350 1077 2455 3296 3662 3702 8096 8457 2329 3827 5790 7245 360 2932 5148 8928 9719 9919 735 1133 2003 2668 2950 3467 3880 6099 6839 8905 579 2063 3869 3916 5268 5343 5914 6440 8795 9654 493 583 774 776 889 943 1483 2693 3644 3717 3854 4885 4937 4964 5766 5831 6194 6435 6592 7108 7391 7417 7906...

result:

ok cost = 8751805

Test #6:

score: 0
Accepted
time: 25ms
memory: 18772kb

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:

2545 2849 1754 9782 3906 4228 7699 5239 9476 1699 5527 7829 3215 8753 9638 5331 4600 7501 8401 271 409 504 777 1132 1155 1753 2078 2219 2402 2629 2672 2756 2819 2885 3165 3243 3251 3363 3368 3612 3620 3766 3905 4012 4074 4233 4236 4257 4509 4632 4640 5146 5332 5396 5816 6095 6253 6601 6684 6738 6792...

result:

ok cost = 10061106

Test #7:

score: 0
Accepted
time: 24ms
memory: 19676kb

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:

8192 1894 7235 9506 50 836 3231 6152 6660 2613 4129 4309 6339 284 307 977 3616 3961 5075 5323 6300 9535 9907 2461 2630 606 1519 1767 3221 4294 8311 8696 8737 9175 9862 1761 9915 4067 6517 7193 7986 191 4584 8782 5345 7788 9057 349 750 1328 1882 2004 4815 5135 5140 5400 5475 7275 7852 9324 9340 9798 ...

result:

ok cost = 1673416

Test #8:

score: 0
Accepted
time: 22ms
memory: 19468kb

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:

5323 1834 9417 1179 2449 1140 8329 9187 9300 4076 5619 6944 9934 1222 2764 3153 4715 5727 6351 8678 9182 9248 9580 1168 639 8052 1016 2890 3439 5963 6874 8806 3717 6857 9975 8647 5584 6035 115 2473 6458 7660 8138 9053 4516 7334 3464 4720 137 546 707 717 747 802 984 999 1018 1152 1293 1338 1381 1507 ...

result:

ok cost = 11294306

Test #9:

score: 0
Accepted
time: 23ms
memory: 19416kb

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:

7415 7633 3019 5123 6525 942 3323 9168 9741 8662 1800 2377 1975 7852 1586 1858 5325 3926 4511 8769 223 6903 4613 5788 9344 6346 6215 9361 2744 4538 2330 3270 9132 7410 5344 8056 1100 2198 2912 3515 3933 5833 6746 7471 7635 7817 8505 8507 9608 3509 1588 3131 780 9374 5825 1627 4920 3286 1170 2965 247...

result:

ok cost = 11579736

Test #10:

score: 0
Accepted
time: 27ms
memory: 20400kb

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:

6341 4220 2468 1714 277 2952 4724 2691 7242 3844 4088 676 1164 1228 2452 2778 5040 7506 8259 6420 5487 157 4917 7595 548 975 1746 3549 4228 4953 2715 8349 7544 8939 1284 854 3647 5958 1050 6344 6345 4328 2040 601 883 968 1502 1813 2227 2444 2510 2707 2834 3523 3627 3674 4046 4089 4293 4319 4401 4615...

result:

ok cost = 11326991

Subtask #2:

score: 0
Wrong Answer

Test #11:

score: 0
Wrong Answer
time: 428ms
memory: 22316kb

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:

14127 62182 56542 3533 37899 44954 76431 84604 91933 95692 124761 144658 154802 170994 171105 190575 199146 15442 21297 29400 34720 34956 37264 43771 57713 70852 73522 98105 104555 108040 136672 148472 158881 178459 179460 180932 189520 4317 19607 23612 32432 43651 46627 47674 57852 84166 90846 9417...

result:

wrong answer cost limit exceeded

Subtask #3:

score: 0
Skipped

Dependency #1:

100%
Accepted

Dependency #2:

0%