# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
970512 | NoMercy | Lightning Rod (NOI18_lightningrod) | C++14 | 1481 ms | 192080 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
int TIME = clock();
#define file \
freopen("in.txt" , "r" , stdin); \
freopen("out.txt" , "w" , stdout);
void test_case () {
int n;
cin >> n;
stack<pair<int , int>> st;
for (int i = 0;i < n;i ++) {
int x , y;
cin >> x >> y;
pair<int , int> tmp = {x , y};
if (st.size() == 0) {
st.push({x , y});
continue;
}
if (abs(x - st.top().first) <= st.top().second - y) {
continue;
}
while ((int)st.size() > 0 && abs(st.top().first - x) <= y - st.top().second) {
st.pop();
}
st.push({x , y});
}
cout << st.size() << "\n";
}
int32_t main () {
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
/// file
int t = 1;
// cin >> t;
while (t --) {
test_case();
}
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... |