제출 #1131445

#제출 시각아이디문제언어결과실행 시간메모리
1131445kemBikeparking (EGOI24_bikeparking)C++20
100 / 100
41 ms2632 KiB
#include <bits/stdc++.h> using namespace std; #define NAME "name" #define ll long long #define pb push_back #define pii pair<int, int> #define fi first #define se second #define endl "\n" #define sz(v) (int)(v).size() #define all(v) (v).begin(), (v).end() #define rall(v) (v).rbegin(), (v).rend() const int LIM = 3e5 + 3; const int INF = 1e9 + 9; const int mod = 1e9 + 7; int n; int x[LIM], y[LIM]; signed main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); if (ifstream(NAME ".inp")) { freopen(NAME ".inp", "r", stdin); freopen(NAME ".out", "w", stdout); } cin >> n; for (int i = 1; i <= n; i++) cin >> x[i]; for (int i = 1; i <= n; i++) cin >> y[i]; int pos = 0, nor = 0, neg = 0; for (int i = n; i >= 1; i--) { int res1 = min(neg, x[i]); neg -= res1, x[i] -= res1; int res2 = min(nor, x[i]); nor -= res2, x[i] -= res2; pos += res1 + res2; nor += min(x[i], y[i]); neg += y[i] - min(x[i], y[i]); } cout << pos - neg; return 0; }

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

Main.cpp: In function 'int main()':
Main.cpp:32:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   32 |         freopen(NAME ".inp", "r", stdin);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
Main.cpp:33:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   33 |         freopen(NAME ".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...