| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 373032 | sam571128 | Planine (COCI21_planine) | C++14 | 4 ms | 752 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#define int long long
#define fastio ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
using namespace std;
vector<pair<int,int>> seg;
int n, h;
int findp(int x1, int y1, int x2, int y2){
return (h-y1)*(x2-x1)/(y2-y1)+x1;
}
signed main(){
fastio
cin >> n >> h;
vector<pair<int,int>> v;
for(int i = 0;i < n;i++){
int x,y;
cin >> x >> y;
v.push_back({x,y});
}
for(int i = 2;i < n-1;i+=2){
seg.push_back({findp(v[i-1].first,v[i-1].second,v[i].first,v[i].second),findp(v[i].first,v[i].second,v[i+1].first,v[i+1].second)});
}
sort(seg.begin(),seg.end(),[&](pair<int,int> a, pair<int,int> b){
return a.second < b.second;
});
int lst = -1e18, ans = 0;
for(auto [a,b] : seg){
cout << a << " " << b << "\n";
if(lst >= a) continue;
else lst = b, ans++;
}
cout << ans << "\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... | ||||
