제출 #200868

#제출 시각아이디문제언어결과실행 시간메모리
200868wendy_virgoStove (JOI18_stove)C++14
0 / 100
6 ms248 KiB
#include <bits/stdc++.h> using namespace std; #define taskname "JOI18_stove" #define forinc(i, a, b) for (int i = (a), _b = (b); i <= _b; ++i) #define fordec(i, a, b) for (int i = (a), _b = (b); i >= _b; --i) #define foreach(i, x) for (auto &i : x) #define ms(x, n) memset(x, n, sizeof(x)) #define sz(x) int((x).size()) #define all(x) (x).begin(), (x).end() #define uni(x) (x).erase(unique(all(x)), (x).end()) #define fi first #define se second #define pb push_back #define pf push_front template<typename TH> void _dbg(const char* sdbg, TH h) { cerr << sdbg << " = " << h << "\n"; } template<typename TH, typename... TA> void _dbg(const char* sdbg, TH h, TA... t) { while (*sdbg != ',') cerr << *sdbg++; cerr << " = " << h << ","; _dbg(sdbg + 1, t...); } #define db(...) _dbg(#__VA_ARGS__, __VA_ARGS__) #define chkpt cerr << "--- Checkpoint here ---\n"; const int N=1e5+5; const int64_t LINF=1e18; int n,k,a[N]; int64_t f[1005][1005]; void Solve() { forinc(i,0,n) { forinc(j,0,k) { f[i][j]=LINF; } } f[0][0]=0; forinc(i,1,n) { forinc(j,1,k) { forinc(p,0,i-1) { if(f[p][j-1]!=LINF) { f[i][j]=min(f[i][j],f[p][j-1]+(a[i]-a[p+1]+1)); } } } } int64_t ans=LINF; forinc(i,0,k) { ans=min(ans,f[n][i]); } cout<<ans<<'\n'; } int main() { ios_base::sync_with_stdio(0); cin.tie(0); #ifndef ONLINE_JUDGE freopen(taskname".INP","r",stdin); #endif // ONLINE_JUDGE cin>>n>>k; forinc(i,1,n) { cin>>a[i]; } Solve(); return 0; }

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

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