# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
544459 | ac2hu | Lightning Rod (NOI18_lightningrod) | C++14 | 1888 ms | 262144 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#ifdef DEBUG
#include "../templates/debug.h"
#else
#define deb(x...)
#endif
using namespace std;
void setIO(string name) {
#ifdef DEBUG
#else
ios_base::sync_with_stdio(0); cin.tie(0);
freopen((name+".in").c_str(),"r",stdin);
freopen((name+".out").c_str(),"w",stdout);
#endif
}
signed main() {
iostream::sync_with_stdio(false);
cin.tie(nullptr);cout.tie(nullptr);
int n;cin >> n;
vector<pair<int,int>> a(n);
for(auto &e : a){
cin >> e.first >> e.second;
}
auto fit = [&](pair<int,int> a,pair<int,int> b) -> bool{
// if b can't fit a
return (abs(b.first - a.first) <= abs(b.second - a.second));
};
auto better = [&](pair<int,int> a, pair<int,int> b) -> bool{
if(a.first + a.second > b.first + b.second)
return true;
return false;
};
vector<pair<int,int>> st;
st.push_back(a[0]);
for(int i = 1;i<n;i++){
while(st.size() > 0 && fit(a[i], st.back()) && better(a[i], st.back())){
st.pop_back();
}
if(st.size() == 0 || !fit(a[i], st.back())){//(!fit(a[i], st.back()) && !better(st.back(), a[i]))){
st.push_back(a[i]);
}
deb(st);
}
// cout << fit(a[n - 1], st.back()) << " " << better(st.back(), a[n - 1]) << "\n";
cout << st.size() << "\n";
}
컴파일 시 표준 에러 (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... |