10e15为什么会RE呐?!
查看原帖
10e15为什么会RE呐?!
142549
hbhz_zcy楼主2021/6/24 16:22

拿到了前六个点 根据理论上10e9\*10e6=10e15,应该不会超出long long的

code

#include<iostream>
#include<cstdio>
#define LL long long
using namespace std;
const int maxn=1e6+50;
LL n,k,a=0,b=0;
bool x[maxn]={},y[maxn]={};
int main(){
	scanf("%lld%lld",&n,&k);
	for(int i=1;i<=k;i++){
		int e,f;scanf("%d%d",&e,&f);
		x[e]=y[f]=1;
	}
	for(int i=1;i<=n;i++){
		if(x[i])  a++;
		if(y[i])  b++;
	}
	printf("%lld",n*(a+b)-a*b);
	return 0;
}
2021/6/24 16:22
加载中...