| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 1311758 | chithanhnguyen | Fuel Station (NOI20_fuelstation) | C++20 | 104 ms | 7240 KiB |
// .=*#=
// .=*=+* -#:
// -*+. += .#=
// -*= *- .#=
// :*= *#++#* .%:
// ++. *- =+ -#
// :*- *- *= %-
// .------::. -*. += -+++-. *#
// -*:-=+*#%#*++-. =+ -+ :+*- +@.
// :* .-++-:=++: ++ .# .*: +%-
// .# .:+#- .=*=. =+ *: :++. *+=
// % -%*=-=*. :*+. -* :* :++=. #-+
// #: .=*- .*: :*= .:==++++* +- -**+: :*:+
// += -#: *- :*- :=++=-:. =*- :+++- *-:+
// -# .=*- *- =*+*=: -*= == .# -#++++++++=-:
// @: =*: #: .. -*-# *: == .:-+++:
// ** :#: .#. .*@. =+ +: .-*+:
// :@: .=++=:. -* +. :# #. .+*:
// ## :-*@* +- .#. .# .++=-.
// :@+ =#*++-.# *: -+ .-+++-
// *%- #+- *. .-*+.
// .##- +@ -. .# .++.
// :*++ :% .=+. :*:*: :*-
// =+-*: - :++. .** =. +=
// =+.++: .++. #. == +=
// =+ .=*=. .*: *: *: *:
// -*. :++=: .#. #. .-*- .#
// :*: .=: *: += .-=+++++==++++=: *:
// .*= ... . += -++=:. :+
// -*: .. =++++==++++=: :*+++- #
// .++. == . .== .+%*=. %
// .*+== =#%= %
// :#* .:. -***..::. %
// #: +%@@: -*-+%++=--*- .#
// .*- :=*= -*- =%- *: -=
// =*=. =*- -* # .-. #.
// :=#*++++++++++++++++-:::-+*- #. .*+=#. ==
// *: .*- #----: == %+++++++++: -*
// % -*+- .#: #. +- -*
// % ##:+**. =*%. -% -+ ++
// *: #:+: :**-+= .## :* :*-
// :#=- +-# :*: .#:# :#. :*+.
// .*#+*+. :*. .*: % .#*+=: :*+.
// #..+ :*: #. .++ :+*-
// :**= # :++. == .*+. .:=++=.
// :=++*++=. .# .+%+==++++++-.
// *: .-+++++=-::..
// :* .=++=:.
// +- -*+:
// .#..=*-
// =#*:
// .-
#include <bits/stdc++.h>
#define prob ""
#define int long long
using namespace std;
void file(){
freopen(prob".INP", "r", stdin);
freopen(prob".OUT", "w", stdout);
}
void Init() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
//file();
}
struct c{
int x,f,r;
};
bool check(c a,c b){
return a.x<b.x;
}
void Sol() {
int n,h;
cin>>n>>h;
vector<c>a(n);
for(int i=0;i<n;i++){
cin>>a[i].x>>a[i].f>>a[i].r;
}
sort(a.begin(),a.end(),check);
int l=0,r=0,res=-1;
for(auto i:a){
r=max(r,i.r);
}
int temp=a[0].x;
for(int i=0;i<n;i++){
if(temp>=a[i].x&&a[0].x<=a[i].r){
temp+=a[i].f;
}
}
if(temp>=h){
res=a[0].x;
cout<<res;
return;
}
while(l<=r){
int mid=(l+r)/2;
temp=mid;
for(int i=0;i<n;i++){
if(temp>=a[i].x&&mid<=a[i].r){
temp+=a[i].f;
}
}
//cout<<mid<<" "<<temp<<"\n";
if(temp>=h){
res=mid;
r=mid-1;
}else{
l=mid+1;
}
}
cout<<(res==-1?h:res);
}
signed main(){
Init();
Sol();
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... | ||||
