为什么IDE上运行是正确的提交以后答案却错误?
  • 板块P1142 轰炸
  • 楼主Mingxuan
  • 当前回复1
  • 已保存回复1
  • 发布时间2024/9/18 22:24
  • 上次更新2024/9/19 14:34:20
查看原帖
为什么IDE上运行是正确的提交以后答案却错误?
162151
Mingxuan楼主2024/9/18 22:24
#include<bits/stdc++.h>
using namespace std;
map<pair<double,double>,int> s;
map<pair<double,double>,int>::iterator it;
int n,a[701],b[701],maxx=-1;
int main()
{
	double k,m;
	cin>>n;
	for(int i=0;i<n;i++)
	{
		cin>>a[i]>>b[i];
	}
	for(int i=1;i<n;i++)
		for(int j=0;j<i;j++)
		{
			k=(b[i]-b[j])*1.0/(a[i]-a[j]);
			m=b[i]-k*a[i];
			s[{k,m}]++;
		}
	for(it=s.begin();it!=s.end();it++)
	if(it->second>maxx) maxx=it->second;
	maxx=maxx<<1;
	for(int i=1;i<100;i++)
		if(i*(i+1)==maxx) 
		{
			cout<<i+1;
			break;
		}
	return 0;
} 

详见样例

128
-2061 4986
7915 2807
11580 6378
13393 4316
-15760 5211
-15762 5178
8274 -13310
-14081 -3465
3268 905
12410 12722
-7444 12722
-9919 -8761
13390 4329
-2840 4663
-7441 12693
3222 963
-1938 5037
9293 -10540
-2471 4816
8306 -13352
-9546 -10005
-3045 4578
4089 -11045
13235 12637
-9541 -10034
3245 934
13112 12655
-7450 12780
-13944 -15474
-7447 12751
-2225 4918
-1897 5054
-15766 5112
8514 -13625
7987 2795
-13985 -3435
3291 876
13030 12667
13744 -13560
11572 6343
-9943 -8718
8482 -13583
-2758 4697
8370 -13436
-2676 4731
2257 14561
13792 -13549
-2020 5003
-13937 -3420
9277 -10584
13194 12643
4833 -13541
4839 -13580
8290 -13331
-7456 12838
2329 14600
-13793 -3375
-13745 -3360
-2307 4884
-2799 4680
-13841 -3390
-15764 5145
9285 -10562
-2594 4765
-3004 4595
-9871 -8847
-2553 4782
-15927 -6735
-2184 4935
8386 -13457
13696 -13571
-7453 12809
7951 2801
-2266 4901
2281 14574
-2922 4629
3314 847
-2881 4646
13396 4303
-2430 4833
13153 12649
8466 -13562
-2102 4969
-1272 -10563
12948 12679
13071 12661
-2348 4867
-1856 5071
8418 -13499
-14033 -3450
4062 -11048
2305 14587
13600 -13593
-1979 5020
9269 -10606
-9967 -8675
-2512 4799
-2717 4714
8322 -13373
-7438 12664
8450 -13541
13399 4290
8402 -13478
8354 -13415
9261 -10628
-2143 4952
15924 -2075
-1806 6824
-15768 5079
-13889 -3405
8338 -13394
-2635 4748
-2389 4850
-3127 4544
8498 -13604
-1815 5088
11564 6308
12989 12673
-2963 4612
-9895 -8804
-3168 4527
-3086 4561
-15896 -6746
-7435 12635
-9991 -8632
12907 12685
13648 -13582
8434 -13520

我下载下来的答案是34,然而我在本机和luogu IDE上运行的答案都是34,为啥提交上去就WA了?

2024/9/18 22:24
加载中...