Submission #342555

# Submission time Handle Problem Language Result Execution time Memory
342555 2021-01-02T11:06:41 Z Hazem Pismo (COCI18_pismo) C++14
70 / 70
15 ms 1900 KB
/*
ID: tmhazem1
LANG: C++14
TASK: pprime
*/
 
#include <bits/stdc++.h>
using namespace std;
 
#define S second
#define F first
#define LL long long
 
const int N = 2e5+10;
 
 
LL LINF = 100000000000000000;
LL INF = 1000000000;
int MOD = 1e9+7;

LL a[N];

int main()
{
    // freopen("out.txt","w",stdout);
    int n;
    scanf("%d",&n);

    for(int i=1;i<=n;i++)
        scanf("%lld",&a[i]);

    LL ans = LINF;
    for(int i=1;i<n;i++)
        ans = min(ans,abs(a[i]-a[i+1]));

    printf("%lld\n",ans);
}

Compilation message

pismo.cpp: In function 'int main()':
pismo.cpp:27:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   27 |     scanf("%d",&n);
      |     ~~~~~^~~~~~~~~
pismo.cpp:30:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   30 |         scanf("%lld",&a[i]);
      |         ~~~~~^~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Correct 14 ms 1900 KB Output is correct
6 Correct 15 ms 1900 KB Output is correct
7 Correct 14 ms 1900 KB Output is correct