Submission #94917

# Submission time Handle Problem Language Result Execution time Memory
94917 2019-01-25T07:36:31 Z karlopuh Pismo (COCI18_pismo) C++14
40 / 70
1000 ms 1780 KB
    #include <bits/stdc++.h>
    using namespace std;
     
    vector < pair<long long int,long long int> > niz; //min i max
    long long int n,a,test;
    long long 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 time Memory Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Correct 5 ms 376 KB Output is correct
4 Correct 6 ms 376 KB Output is correct
5 Execution timed out 1081 ms 1520 KB Time limit exceeded
6 Execution timed out 1076 ms 1780 KB Time limit exceeded
7 Execution timed out 1079 ms 1456 KB Time limit exceeded