제출 #1153967

#제출 시각아이디문제언어결과실행 시간메모리
1153967salmonPo (COCI21_po)C++20
70 / 70
8 ms1096 KiB
#include <bits/stdc++.h> using namespace std; int N; int lst[100100]; vector<int> b; int main(){ scanf(" %d",&N); for(int i = 0; i < N; i++){ scanf(" %d",&lst[i]); } int cont = 0; for(int i = 0; i < N; i++){ while(!b.empty() && b.back() > lst[i]){ b.pop_back(); cont++; } if(lst[i] == 0) continue; if(b.empty() || b.back() != lst[i]) b.push_back(lst[i]); } cont += b.size(); printf("%d\n",cont); }

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

Main.cpp: In function 'int main()':
Main.cpp:9:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
    9 |     scanf(" %d",&N);
      |     ~~~~~^~~~~~~~~~
Main.cpp:12:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   12 |         scanf(" %d",&lst[i]);
      |         ~~~~~^~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...