Submission #146092

#TimeUsernameProblemLanguageResultExecution timeMemory
146092youssan_williamPismo (COCI18_pismo)C++14
20 / 70
1082 ms1912 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { ll n ; cin >> n; ll arr[n+1]; for(int i = 1 ; i <=n ;i++) cin >> arr[i]; ll answer=10000000000 , minimum=10000000000 , maximum=-1 , secMinimum , secMaximum ; ll l=1 , r=2; for( ; ; r++) { if(r>n) { l++; r=l+1; } if(l>n) { break; } minimum=10000000000 , maximum=-1; for(int i = l ; i <= r ;i++) { minimum=min(minimum,arr[i]); maximum=max(maximum,arr[i]); } answer=min(answer,maximum-minimum); } cout << answer ; return 0; }

Compilation message (stderr)

pismo.cpp: In function 'int main()':
pismo.cpp:12:64: warning: unused variable 'secMinimum' [-Wunused-variable]
     ll answer=10000000000 , minimum=10000000000 , maximum=-1 , secMinimum , secMaximum ;
                                                                ^~~~~~~~~~
pismo.cpp:12:77: warning: unused variable 'secMaximum' [-Wunused-variable]
     ll answer=10000000000 , minimum=10000000000 , maximum=-1 , secMinimum , secMaximum ;
                                                                             ^~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...