제출 #721351

#제출 시각아이디문제언어결과실행 시간메모리
721351beaconmc선물상자 (IOI15_boxes)C++14
35 / 100
71 ms156848 KiB
#include "boxes.h" #include <bits/stdc++.h> //#include <ext/pb_ds/assoc_container.hpp> //#include <ext/pb_ds/tree_policy.hpp> typedef long long ll; using namespace std; //using namespace __gnu_pbds; #define FOR(i, x, y) for(ll i=x; i<y; i++) #define FORNEG(i, x, y) for(ll i=x; i>y; i--) //#define ordered_set tree<ll, null_type,less_equal<ll>, rb_tree_tag,tree_order_statistics_node_update> #define fast() ios_base::sync_with_stdio(false);cin.tie(NULL) ll dp1[10000001], dp2[10000001]; long long delivery(int N, int K, int L, int p[]) { FOR(i,0,10000001) dp1[i] = 0, dp2[i] = 0; vector<ll> pp; FOR(i,0,N){ if (p[i] != 0) pp.push_back(p[i]); } N = pp.size(); FOR(i,0,min(K, N)){ dp1[i] = pp[i] + min(pp[i], (L-pp[i])); } FOR(i,K,N){ dp1[i] = dp1[i-K] + pp[i]*2; } FORNEG(i,N-1, max(N-K-1, -1)){ dp2[i] = (L-pp[i]) + min(pp[i], (L-pp[i])); } FORNEG(i, N-K-1, -1){ dp2[i] = dp2[i+K] + (L-pp[i])*2; } ll ans = dp2[0]; FOR(i,0,N){ ans = min(ans, dp1[i] + dp2[i+1]); } return ans; }

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

boxes.cpp: In function 'long long int delivery(int, int, int, int*)':
boxes.cpp:24:16: warning: conversion from 'std::vector<long long int>::size_type' {aka 'long unsigned int'} to 'int' may change value [-Wconversion]
   24 |     N = pp.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...