警示后人

P1678 烦恼的高考志愿

JerryGuoZhe @ 2024-01-29 22:08:54

十年OI一场空,不开long long见祖宗。

答案可能大于2147483647


by nianiii @ 2024-01-30 20:24:09

感谢!不开 long long 过不去最后一个点


by qleizhengye2022 @ 2024-02-02 21:00:45

@JerryGuoZhe 感谢


by masonxiong @ 2024-02-07 16:43:19

非常感谢,死磕了半天最后一个点


by yashi258 @ 2024-02-10 13:53:35

感谢orz!


by xtckx1225 @ 2024-02-18 17:01:32


#include<bits/stdc++.h>
using namespace std;
long long n,m,xx[100010],xs[100010],d=1000000,z=0;
int main(){
    cin>>m>>n;
    for(long long i=0;i<m;i++)cin>>xx[i];
    for(long long i=0;i<n;i++){
        cin>>xs[i]; 
        d=1000000;
        for(long long j=0;j<m;j++)if(abs(xx[j]-xs[i])<d)d=abs(xx[j]-xs[i]);
        z+=d;
    }cout<<z;
    return 0;
} ```

|