Submission #884146

# Submission time Handle Problem Language Result Execution time Memory
884146 2023-12-06T16:10:38 Z vjudge1 Pismo (COCI18_pismo) C++17
70 / 70
8 ms 348 KB
#pragma GCC optimize("unroll-loops,Ofast,O3")
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define spc << " " <<
#define endl "\n"
#define all(x) x.begin(), x.end()
#define int long long
#define ii pair<int,int>
#define vi vector<int>
#define vii vector<ii>
#define st first
#define nd second
#define inf 1000000009
#define MOD 998244353
#define lim 200005
using namespace std;





void solve(){
    int n; cin >> n;
    int temp; cin >> temp;
    int ans=inf;
    for(int i=2; i<=n; i++){
        int a; cin >> a;
        ans = min(ans, abs(a-temp));
        temp=a;
    }
    cout << ans << endl;
}



signed main(){
    ios_base::sync_with_stdio(false);cin.tie(0);
    #ifdef Local
    freopen("in","r",stdin);
    freopen("out","w",stdout);
    #endif

    /*freopen("fcolor.in","r",stdin);
    freopen("fcolor.out","w",stdout);*/

    int t=1;
    //cin >> t;
    while(t--) solve();
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 7 ms 348 KB Output is correct
6 Correct 8 ms 348 KB Output is correct
7 Correct 7 ms 344 KB Output is correct