제출 #1152083

#제출 시각아이디문제언어결과실행 시간메모리
1152083SmuggingSpunBuilding Bridges (CEOI17_building)C++20
30 / 100
1 ms328 KiB
#include<bits/stdc++.h> #define taskname "A" using namespace std; typedef long long ll; const ll INF = 1e18; template<class T>void minimize(T& a, T b){ if(a > b){ a = b; } } ll square(int x){ return 1LL * x * x; } int n; namespace sub1{ void solve(){ vector<int>h(n + 1), w(n + 1); for(int i = 1; i <= n; i++){ cin >> h[i]; } for(int i = 1; i <= n; i++){ cin >> w[i]; } vector<ll>dp(n + 1, INF); dp[1] = 0; for(int i = 2; i <= n; i++){ ll sum = 0; for(int j = i - 1; j > 0; sum += w[j--]){ minimize(dp[i], dp[j] + square(h[i] - h[j]) + sum); } } cout << dp[n]; } } int main(){ ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); if(fopen(taskname".inp", "r")){ freopen(taskname".inp", "r", stdin); } cin >> n; if(n <= 1000){ sub1::solve(); } }

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

building.cpp: In function 'int main()':
building.cpp:38:24: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   38 |                 freopen(taskname".inp", "r", stdin);
      |                 ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...