제출 #714077

#제출 시각아이디문제언어결과실행 시간메모리
714077mseebacher선물상자 (IOI15_boxes)C++17
100 / 100
489 ms209580 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef vector<int> vi; #define MAXI (int)1e5 #define pb(x) push_back(x) vector<int> ad[MAXI]; vector<bool> vis(MAXI,0); void dfs(int x){ if(vis[x]) return; vis[x] = 1; for(auto s:ad[x]){ dfs(s); } } void setIO(string s) { freopen((s + ".in").c_str(), "r", stdin); freopen((s + ".out").c_str(), "w", stdout); } ll delivery(int n,int k,int l,int pos[]){ ll ans = 1e18; vector<ll> pref(n+1,0); vector<ll> suff(n+2,0); for(int i = 1;i<=n;i++) pref[i] = 2*pos[i-1] + pref[(max(0,i-k))]; for(int i = n;i>0;i--) suff[i] = 2*(l-pos[i-1]) + suff[min(n+1,i+k)]; for(int i = 0;i<=n;i++){ ans = min(ans,pref[i]+suff[i+1]); ans = min(ans,pref[i]+l+suff[min(n+1,i+k+1)]); } return ans; }

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

boxes.cpp: In function 'void setIO(std::string)':
boxes.cpp:22:9: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   22 |  freopen((s + ".in").c_str(), "r", stdin);
      |  ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
boxes.cpp:23:9: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   23 |  freopen((s + ".out").c_str(), "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...