제출 #404694

#제출 시각아이디문제언어결과실행 시간메모리
404694Dakto선물상자 (IOI15_boxes)C++17
0 / 100
6 ms332 KiB
#include <bits/stdc++.h> using namespace std; int delivery(int n, int k, int l, int V[]){ vector<int> v(V, V+n); v.erase(v.begin(),lower_bound(v.begin(),v.end(),1)); n=v.size(); vector<int> ps; int c=0; for(int i=0; i<n; i++){ ps.push_back(min(2*v[i], l)+c); if((i-1)%k==0){ c+=min(2*v[i],l); } } for(auto i:ps) cerr<<i<<endl; int res=ps[n-1]; c=0; int j=0; for(int i=n-1; i>=0; i--, j++){ res=min(res,(i?ps[i-1]:0)+min(2*(l-v[i]), l)+c); if((j-1)%k==0){ c+=min(2*(l-v[i]),l); } } return res; }

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

boxes.cpp: In function 'int delivery(int, int, int, int*)':
boxes.cpp:8:13: warning: conversion from 'std::vector<int>::size_type' {aka 'long unsigned int'} to 'int' may change value [-Wconversion]
    8 |     n=v.size();
      |       ~~~~~~^~
#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...