Submission #776609

# Submission time Handle Problem Language Result Execution time Memory
776609 2023-07-08T05:44:29 Z vjudge1 Pismo (COCI18_pismo) C++17
70 / 70
27 ms 1104 KB
#include<bits/stdc++.h>
using namespace std;
#define lalala ios_base::sync_with_stdio(false);cin.tie(NULL);
//#define endl '\n'
#define ll long long
#define N 100005
ll int arr[N],seg[N*4],segment[N*4];
inline void minbuid(int x,int l,int r){
	if(l>r)return;
	if(l==r){seg[x]=arr[l];return;}
	int m=(l+r)/2;
	minbuid(x*2,l,m);minbuid(x*2+1,m+1,r);
	seg[x]=min(seg[x*2],seg[x*2+1]);
}
inline void maxbuid(int x,int l,int r){
	if(l>r)return;
	if(l==r){segment[x]=arr[l];return;}
	int m=(l+r)/2;
	maxbuid(x*2,l,m);maxbuid(x*2+1,m+1,r);
	segment[x]=min(segment[x*2],segment[x*2+1]);
}
int main(){
	int n;cin>>n;
	for(int i=0;i<n;i++)cin>>arr[i];
	ll int cev=1000000000000000000;
	for(int i=0;i<n-1;i++){
		cev=min(cev,abs(arr[i]-arr[i+1]));
	}
	cout<<cev<<endl;

}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 27 ms 1084 KB Output is correct
6 Correct 25 ms 1104 KB Output is correct
7 Correct 26 ms 1084 KB Output is correct