답안 #94711

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
94711 2019-01-23T07:03:16 Z AKaan37 Pismo (COCI18_pismo) C++17
70 / 70
17 ms 1144 KB
#include <bits/stdc++.h>

using namespace std;

typedef long long int lo;
typedef pair<int,int> PII;

#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define FOR for(lo i=1;i<=  n;i++)
#define fio() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define mid (start+end)/2

const lo mod = 1000000007;
const lo li = 100005;
const lo inf = 1000000000;
const lo MAX = 1000000000000000000;
const lo MIN = -1000000000000000000;
const lo LOG = 30;

lo n,m,cev=inf,a[li];

int main(){
	scanf("%lld",&n);
	FOR{
		scanf("%lld",&a[i]);
	}
	for(lo i=2;i<=n;i++){
		lo mx;
		lo mn;
		mx=max(a[i-1],a[i]);
		mn=min(a[i-1],a[i]);
		//~ cout<<mx<<" "<<mn<<endl;
		cev=min(cev,mx-mn);
	}
	printf("%lld\n",cev);
	return 0;
}

Compilation message

pismo.cpp: In function 'int main()':
pismo.cpp:26:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%lld",&n);
  ~~~~~^~~~~~~~~~~
pismo.cpp:28:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%lld",&a[i]);
   ~~~~~^~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 16 ms 1144 KB Output is correct
6 Correct 17 ms 988 KB Output is correct
7 Correct 15 ms 1016 KB Output is correct