제출 #782751

#제출 시각아이디문제언어결과실행 시간메모리
7827511075508020060209tcPo (COCI21_po)C++14
컴파일 에러
0 ms0 KiB
#include<bits/stdc++.h> using namespace std; #define int long long #define X first #define Y second int n; int ar[500005]; signed main(){ int ans=0; cin>>n; for(int i=1;i<=n;i++){ cin>>ar[i]; } stack<int>stk; for(int i=1;i<=n;i++){ while(stk.size()&&stk.top()>ar[i]){stk.pop();} if(stk.size()&&stk.top()==ar[i]){continue if(ar[i]==0){continue;} stk.push(ar[i]); ans++; } cout<<ans; }

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

Main.cpp: In function 'int main()':
Main.cpp:18:46: error: expected ';' before 'if'
   18 |     if(stk.size()&&stk.top()==ar[i]){continue
      |                                              ^
      |                                              ;
   19 |     if(ar[i]==0){continue;}
      |     ~~                                        
Main.cpp:25:1: error: expected '}' at end of input
   25 | }
      | ^
Main.cpp:9:14: note: to match this '{'
    9 | signed main(){
      |              ^