Submission #530732

# Submission time Handle Problem Language Result Execution time Memory
530732 2022-02-26T15:32:26 Z ammar2000 Pismo (COCI18_pismo) C++17
70 / 70
10 ms 1916 KB
#include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define F first
#define S second
#define coy cout<<"YES\n"
#define con cout<<"NO\n"
#define co1 cout<<"-1\n"
#define sc(x) scanf("%lld",&x)
#define all(x) x.begin(),x.end()
#define fast ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
using namespace std;
const int SI=3e5+7;
ll INF=8e18+7;
int dx[] = {1 , -1 , 0 , 0};
int dy[] = {0 , 0 , 1 , -1};
int MOD=1e9+7;
ll ans=INF;
ll n,a[SI];
int main()
{
   fast
   cin>>n;
   for (int i=0;i<n;i++)
    cin>>a[i];
   for (int i=1;i<n;i++)
    ans=min(ans,abs(a[i]-a[i-1]));
   cout <<ans <<"\n";
   // use scanf not cin
   return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 208 KB Output is correct
2 Correct 1 ms 328 KB Output is correct
3 Correct 1 ms 336 KB Output is correct
4 Correct 1 ms 336 KB Output is correct
5 Correct 9 ms 1864 KB Output is correct
6 Correct 10 ms 1916 KB Output is correct
7 Correct 10 ms 1780 KB Output is correct