Submission #438465

#TimeUsernameProblemLanguageResultExecution timeMemory
438465adamjinweiBoxes with souvenirs (IOI15_boxes)C++14
100 / 100
600 ms221764 KiB
#include <bits/stdc++.h> #include "boxes.h" #define inf 1000000000000000007 #define mod 1000000007 #define rnd() rand_num() #define bigrnd() dis(rand_num) //#pragma GCC optimize("Ofast","inline","-ffast-math") //#pragma GCC target("avx,sse2,sse3,sse4,mmx") //#define int long long using namespace std; unsigned sed=std::chrono::system_clock::now().time_since_epoch().count(); mt19937 rand_num(sed); uniform_int_distribution<long long> dis(0,inf); template <typename T> void read(T &x){ x=0;char ch=getchar();int fh=1; while (ch<'0'||ch>'9'){if (ch=='-')fh=-1;ch=getchar();} while (ch>='0'&&ch<='9')x=x*10+ch-'0',ch=getchar(); x*=fh; } template <typename T> void write(T x) { if (x<0) x=-x,putchar('-'); if (x>9) write(x/10); putchar(x%10+'0'); } template <typename T> void writeln(T x) { write(x); puts(""); } long long f[10000005],g[10000005]; long long delivery(int N,int K,int L,int positions[]) { for(int i=1;i<=N;++i) f[i]=f[max(0,i-K)]+2*positions[i-1]; for(int i=N;i>=1;--i) g[i]=g[min(N+1,i+K)]+2*(L-positions[i-1]); long long ans=inf; for(int i=0;i<=N;++i) { ans=min(ans,f[i]+g[i+1]); if(i+K<=N) ans=min(ans,f[i]+L+g[i+K+1]); } return ans; }

Compilation message (stderr)

boxes.cpp:11:71: warning: conversion from 'std::chrono::duration<long int, std::ratio<1, 1000000000> >::rep' {aka 'long int'} to 'unsigned int' may change value [-Wconversion]
   11 | unsigned sed=std::chrono::system_clock::now().time_since_epoch().count();
      |              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~
#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...