제출 #1122538

#제출 시각아이디문제언어결과실행 시간메모리
1122538AnhPhamBikeparking (EGOI24_bikeparking)C++20
25 / 100
44 ms5108 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 **/ const int mxN = 3e5 + 5; int N; int X[mxN], Y[mxN]; namespace sub12 { bool check_condition() { return ((N == 2 && *max_element(X, X + N) <= 100 && *max_element(Y, Y + N) <= 100) || (*min_element(X, X + N) == *max_element(X, X + N) && *min_element(Y, Y + N) == *max_element(Y, Y + N))); } void solve() { int ans = 0; int ptr = 0; for (int i = 0; i < N; ++i) { while (X[ptr] == 0) ptr++; if (ptr >= i) continue; int val = min(X[ptr], Y[i]); X[ptr] -= val; Y[i] -= val; ans += val; } for (int i = 0; i < N; ++i) { int val = min(X[i], Y[i]); X[i] -= val; Y[i] -= val; } for (int i = 0; i < N; ++i) ans -= Y[i]; cout << ans << '\n'; } } void solve() { cin >> N; for (int i = 0; i < N; ++i) cin >> X[i]; for (int i = 0; i < N; ++i) cin >> Y[i]; if (sub12 :: check_condition()) sub12 :: solve(); }

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

Main.cpp: In function 'int32_t main()':
Main.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);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
Main.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...