Submission #311177

#TimeUsernameProblemLanguageResultExecution timeMemory
311177phathnvPismo (COCI18_pismo)C++11
70 / 70
20 ms1656 KiB
#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 (stderr)

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 timeMemoryGrader output
Fetching results...