제출 #951501

#제출 시각아이디문제언어결과실행 시간메모리
951501Trisanu_DasEditor (BOI15_edi)C++17
100 / 100
168 ms51328 KiB
#include <bits/stdc++.h> using namespace std; const int N=300050; const int L=19; int a[N],go[N][L],mn[N][L],ans[N]; int main(){ int n; scanf("%i",&n); for(int i=1;i<=n;i++){ scanf("%i",&a[i]); if(a[i]>0)ans[i]=a[i]; else{ int x=-a[i]; int j=i-1; for(int k=L-1;~k;k--)if(mn[j][k]>=x)j=go[j][k]; ans[i]=ans[j-1]; go[i][0]=j-1; mn[i][0]=x; for(int k=1;k<L;k++){ go[i][k]=go[go[i][k-1]][k-1]; mn[i][k]=min(mn[i][k-1],mn[go[i][k-1]][k-1]); } } printf("%i\n",ans[i]); } return 0; }

컴파일 시 표준 에러 (stderr) 메시지

edi.cpp: In function 'int main()':
edi.cpp:8:7: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
    8 |  scanf("%i",&n);
      |  ~~~~~^~~~~~~~~
edi.cpp:10:8: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   10 |   scanf("%i",&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...