3 solutions
-
0
Guest MOD
-
1
嗨嗨嗨蓝 劣又来更新了,今天送你们一个程序模板! //[蓝 劣]的程序模板,制作不易!:包括变量、数组、队列、结构体、模数、输入、输出、循环、二分函数、dfs深搜函数、sort比较函数、判断、无返还函数、无返还函数调用、三种实用头文件! #include<bits/stdc++.h> #include #include using namespace std; #define MOD 998244353 int n,m; int a,b; int res=0,sum=0; int x[10005],y[10005]; queue<pair>p; struct node{ int u; int v; int w; string s; }o[50]; void dfs(int max,int h){ if(){
}} bool cmp(int o1,int o2){ if(){ return ; }else{ return ; } } int find(int q){ int r=0,int l=0; while(a[mid]<=r){
}} int main(){ p.front(); p.pop(); cin>>; for(int i=1;i<= ;i++){
} for(int i=1;i<= ;i++){ } for(int i=1;i<= ;i++){ } while(){ } while(!){ } sort(+n,+1+n,cmp); dfs(1,0); printf(); cout<<; cout<<" "; for(int j=1;j<= ;j++){ cout<<; } return 0;}
-
-1
#define int long long #define endl '\n' using namespace std; int n,a[1000000]; bool check(int x){ int i=0,u=0; while(i<n&&u<3){ int l=a[i]+2ll*x; u++; while(i<n&&a[i]<=l)i++; } return i==n; } signed main(){ ios::sync_with_stdio(0); cin.tie(0),cout.tie(0); cin>>n; for(int i=0;i<n;i++){ cin>>a[i]; } sort(a,a+n); int l=0,r=a[n-1]-a[0]; while(l<r){ int mid=(l+r)/2; if(check(mid)){ r=mid; }else{ l=mid+1; } } cout<<l<<endl; return 0; }
- 1
Information
- ID
- 1595
- Time
- 1000ms
- Memory
- 256MiB
- Difficulty
- 7
- Tags
- (None)
- # Submissions
- 47
- Accepted
- 10
- Uploaded By