Submission #951945

#TimeUsernameProblemLanguageResultExecution timeMemory
951945Mohamed_Kachef06Fuel Station (NOI20_fuelstation)C++17
49 / 100
3088 ms22368 KiB
#include <bits/stdc++.h> using namespace std; #define int long long void doWork(){ int N , D; cin >> N >> D; vector<array<int, 3>> v; for (int i = 0 ; i < N ; i++){ int x , a , b ; cin >> x >> a >> b; v.push_back({x , a , b}); } v.push_back({D , 0 , 0}); sort(v.begin() , v.end()); for (int F = 0 ; F <= D ; F++){ bool f = 1; int sum = F; for (int i = 0 ; i <= N ; i++){ if (sum - v[i][0] < 0) {f = 0; break;} if (F <= v[i][2]) sum += v[i][1]; } if (f) {cout << F; break;} } } signed main(){ ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); doWork(); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...