제출 #200615

#제출 시각아이디문제언어결과실행 시간메모리
200615TadijaSebezEditor (BOI15_edi)C++11
63 / 100
113 ms4216 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]); if(mn>=-1){ stack<int> stk; for(int i=1;i<=n;i++){ if(a[i]>0)stk.push(a[i]); else if(stk.size())stk.pop(); if(stk.size())printf("%i\n",stk.top()); else printf("0\n"); } } else{ for(int i=1;i<=n;i++){ stack<int> stk; int ans=0; if(i==n||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; }

컴파일 시 표준 에러 (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...