제출 #94876

#제출 시각아이디문제언어결과실행 시간메모리
94876karlopuhPismo (COCI18_pismo)C++14
40 / 70
1089 ms1112 KiB
#include <bits/stdc++.h>
using namespace std;

vector < pair<int,int> > niz; //min i max
int n,a,test;
int mini=1e9;

int main(){
	cin>>n;
	for(int j=0;j<n;j++){
		cin>>a;
		niz.push_back(make_pair(a,a));
		for(int i=0;i<j;i++){
			if(niz[i].first > a)niz[i].first=a;
			if(niz[i].second < a)niz[i].second=a;
			test=niz[i].second-niz[i].first;
			if(test<mini)mini=test;
		}
	}
	
	cout<<mini;
}
#Verdict Execution timeMemoryGrader output
Fetching results...