Submission #200613

#TimeUsernameProblemLanguageResultExecution timeMemory
200613TadijaSebezEditor (BOI15_edi)C++11
35 / 100
3069 ms4984 KiB
#include <bits/stdc++.h> using namespace std; const int N=300050; int a[N]; int main(){ int n,mn=0; scanf("%i",&n); for(int i=1;i<=n;i++)scanf("%i",&a[i]),mn=min(mn,a[i]); for(int i=1;i<=n;i++){ stack<int> stk; int ans=0; if(i==n||mn>=-1||n<=5000){ for(int j=i;j>=1;j--){ if(stk.size()&&a[j]>stk.top()){ stk.pop(); }else{ if(a[j]>0){ans=a[j];break;} stk.push(a[j]); } } } printf("%i\n",ans); } return 0; }

Compilation message (stderr)

edi.cpp: In function 'int main()':
edi.cpp:7:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%i",&n);
  ~~~~~^~~~~~~~~
edi.cpp:8:40: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  for(int i=1;i<=n;i++)scanf("%i",&a[i]),mn=min(mn,a[i]);
                       ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...