제출 #68401

#제출 시각아이디문제언어결과실행 시간메모리
68401zetapi선물상자 (IOI15_boxes)C++14
0 / 100
3 ms376 KiB
#include "boxes.h" #include "bits/stdc++.h" using namespace std; #define pb push_back #define mp make_pair #define ll long long #define itr ::iterator const int MAX=1e5; ll N,K,L,sz,start[MAX],finish[MAX]; long long delivery(int N_,int K_, int L_,int P[]) { N=N_; K=K_; L=L_; for(int A=0;A<N;A+=K) { start[A/K]=P[A]; finish[A/K]=P[min(A+K-1,N-1)]; sz++; } int res=0; for(int A=0;A<sz;A++) { //cout<<start[A]<<" "<<finish[A]<<"\n"; res+=min(2*finish[A],min(2*(L-start[A]),L)); } return res; } /*int main() { ios_base::sync_with_stdio(false); int P[]={1,2,5}; cout<<delivery(3,2,8,P)<<"\n"; return 0; }*/

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

boxes.cpp: In function 'long long int delivery(int, int, int, int*)':
boxes.cpp:19:22: warning: conversion to 'int' from 'long long int' may alter its value [-Wconversion]
     for(int A=0;A<N;A+=K)
                     ~^~~
boxes.cpp:29:48: warning: conversion to 'int' from 'long long int' may alter its value [-Wconversion]
      res+=min(2*finish[A],min(2*(L-start[A]),L));
                                                ^
#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...