WA 30 分求调
查看原帖
WA 30 分求调
708151
708151_qwq楼主2023/8/3 18:17

rt.

#include <bits/stdc++.h>
#define up(i,x,y) for(int i=(x); i<=(y); i++)
#define dn(i,x,y) for(int i=(x); i>=(y); i--)
#define int128 __int128_t
#define BUG(x) cout << endl << x << endl
#define LF putchar('\n')
#define SP putchar(' ')
#define px(a,n) sort((a)+1, (a)+(n)+1)
#define pxd(a,n) sort((a)+1, (a)+(n)+1, cmp)
#define CLS ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
const int INF=2147483647, inf=1061109567, mod=998244353, MOD=1000000007;
const ll LLINF=9223372036854775807;
template <typename T>
inline void read(T& x){x=0;char ch=getchar();ll f=1;while(!isdigit(ch)){if(ch=='-')f*=-1;ch=getchar();}while(isdigit(ch)){x=x*10+ch-48;ch=getchar();}x*=f;}
template <typename T>
void write(T arg){T x=arg;if(x<0){putchar('-');x=-x;}if(x>9)write(x/10);putchar(x%10+'0');}
int l, n, m, a[50010], cf[50010], b[50010], cnt;
int main() {
	read(l), read(n), read(m);
	up(i,1,n) read(a[i]);
	a[0] = 0, a[n+1] = l;
	up(i,0,n)
		cf[i] = a[i+1] - a[i];
	up(i,0,n) {
		b[++cnt] = cf[i];
		while(cf[i]==cf[i+1]) i++;
	}
	sort(b+1, b+cnt+1);
	write(b[m+1]); 
	return 0;
}
2023/8/3 18:17
加载中...