제출 #404698

#제출 시각아이디문제언어결과실행 시간메모리
404698Dakto선물상자 (IOI15_boxes)C++17
0 / 100
7 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, ps2(n); 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); } } c=0; int j=0; for(int i=n-1; i>=0; i--,j++){ ps2[i]=min(2*(l-v[i]), l)+c; if((j-1)%k==0){ c+=min(2*(l-v[i]),l); } } int res=min(ps[n-1],ps2[0]); for(int i=0; i<n; i++) cerr<<ps[i]<<" "<<ps2[i]<<endl; for(int i=0; i<n-1; i++) res=min(res,ps[i]+ps2[i+1]); 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...