제출 #714074

#제출 시각아이디문제언어결과실행 시간메모리
714074mseebacher선물상자 (IOI15_boxes)C++17
10 / 100
4 ms2668 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 pref(int n,int k,int l,int pos[],int pre){ ll ans = 0; for(int i = 0;i<pre;i+=k){ ans += pos[i] + min(pos[i],l-pos[i]); } if(pre%k != 0)ans += pos[pre-1] + min(pos[pre-1],l-pos[pre-1]); return ans; } ll suff(int n,int k,int l,int pos[],int pre){ ll ans = 0; for(int i = n-1;i>=pre;i-=k){ ans += (l-pos[i]) + min(pos[i],l-pos[i]); } if((n-pre)%k != 0)ans += pos[pre] + min(pos[pre],l-pos[pre]); return ans; } ll delivery(int n,int k,int l,int pos[]){ ll ans = 1e18; for(int i = 0;i<=n;i++){ ans = min(ans,pref(n,k,l,pos,i)+suff(n,k,l,pos,i)); } return ans; }

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

boxes.cpp: In function 'll pref(int, int, int, int*, int)':
boxes.cpp:27:13: warning: unused parameter 'n' [-Wunused-parameter]
   27 | ll pref(int n,int k,int l,int pos[],int pre){
      |         ~~~~^
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...