Submission #311177

# Submission time Handle Problem Language Result Execution time Memory
311177 2020-10-09T14:54:03 Z phathnv Pismo (COCI18_pismo) C++11
70 / 70
20 ms 1656 KB
#include <bits/stdc++.h>

#define mp make_pair
#define X first
#define Y second
#define taskname "PISMO"

using namespace std;

typedef long long ll;
typedef pair <int, int> ii;

const int N = 1e5 + 1;
const int INF = 2e9;

int n, a[N];

void readInput(){
    scanf("%d", &n);
    for(int i = 1; i <= n; i++)
        scanf("%d", &a[i]);
}

void solve(){
    int res = INF;
    for(int i = 2; i <= n; i++)
        res = min(res, abs(a[i - 1] - a[i]));
    printf("%d", res);
}

int main(){
    //freopen(taskname".inp", "r", stdin);
    //freopen(taskname".out", "w", stdout);
    readInput();
    solve();
    return 0;
}

Compilation message

pismo.cpp: In function 'void readInput()':
pismo.cpp:19:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   19 |     scanf("%d", &n);
      |     ~~~~~^~~~~~~~~~
pismo.cpp:21:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   21 |         scanf("%d", &a[i]);
      |         ~~~~~^~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 256 KB Output is correct
2 Correct 0 ms 256 KB Output is correct
3 Correct 1 ms 384 KB Output is correct
4 Correct 1 ms 384 KB Output is correct
5 Correct 18 ms 1536 KB Output is correct
6 Correct 20 ms 1656 KB Output is correct
7 Correct 19 ms 1536 KB Output is correct