제출 #1122438

#제출 시각아이디문제언어결과실행 시간메모리
1122438AnhPhamFuel Station (NOI20_fuelstation)C++20
0 / 100
91 ms7240 KiB
#include <bits/stdc++.h> using namespace std; #define int long long #define sz(v) (int)(v).size() #define all(v) (v).begin(), (v).end() const int MOD = (int)1e9 + 7; const int INF = (int)4e18 + 18; void solve(); int32_t main() { #define CODE "task" if (fopen(CODE".inp", "r")) freopen(CODE".inp", "r", stdin), freopen(CODE".out", "w", stdout); cin.tie(nullptr), cout.tie(nullptr) -> sync_with_stdio(false); int testcases = 1; #define multitest 0 if (multitest) { cin >> testcases; } for (; testcases--;) { solve(); } } /** [Pham Hung Anh - 12I - Tran Hung Dao High School for Gifted Student] **/ /** The Last Dance **/ struct FUELSTATION { int X, A, B; }; int N, D; vector <FUELSTATION> stations; namespace sub1 { bool check_condition() { return N == 1; } void solve() { int ans = -1; int lo = stations[0].X, hi = stations[0].B; while (lo <= hi) { int mid = (lo + hi) >> 1; if (mid + stations[0].A >= D) ans = mid, hi = mid - 1; else lo = mid + 1; } cout << ans << '\n'; } } void solve() { cin >> N >> D; stations = vector <FUELSTATION> (N); for (auto &item : stations) cin >> item.X >> item.A >> item.B; if (sub1 :: check_condition()) sub1 :: solve(); }

컴파일 시 표준 에러 (stderr) 메시지

FuelStation.cpp: In function 'int32_t main()':
FuelStation.cpp:17:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   17 |         freopen(CODE".inp", "r", stdin), freopen(CODE".out", "w", stdout);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
FuelStation.cpp:17:49: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   17 |         freopen(CODE".inp", "r", stdin), freopen(CODE".out", "w", stdout);
      |                                          ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
#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...