제출 #810539

#제출 시각아이디문제언어결과실행 시간메모리
810539tlnk07Po (COCI21_po)C++17
70 / 70
29 ms1456 KiB
#include<bits/stdc++.h>
using namespace std;

long long n, cnt = 0, x;
stack<int> sta;

int main()
{
	cin >> n;
	for(int i = 1; i <= n; ++i)
	{
		cin >> x;
		while(!sta.empty() && sta.top() > x)	sta.pop();
		if(!sta.empty() && sta.top() == x || !x)	continue;
		sta.push(x);
		++cnt;
	}
	cout << cnt;
}

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

Main.cpp: In function 'int main()':
Main.cpp:14:19: warning: suggest parentheses around '&&' within '||' [-Wparentheses]
   14 |   if(!sta.empty() && sta.top() == x || !x) continue;
      |      ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...