# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
265322 | T0p_ | Lightning Rod (NOI18_lightningrod) | C++14 | 714 ms | 192028 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
using namespace std;
stack<pair<int, int>> stk;
int fi()
{
int ret = 0;
while(true)
{
char c = getchar_unlocked();
if('0' <= c && c <= '9')
{
ret *= 10;
ret += (c-'0');
}
else return ret;
}
}
int main()
{
int n = fi();
while(n--)
{
int x = fi(), y = fi();
if(stk.empty()) stk.push({x, y});
else
{
int h = stk.top().second - x + stk.top().first;
if(h >= y) continue ;
while(!stk.empty())
{
int h = y - x + stk.top().first;
if(h >= stk.top().second) stk.pop();
else break ;
}
stk.push({x, y});
}
}
printf("%d\n",stk.size());
return 0;
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |