제출 #438463

#제출 시각아이디문제언어결과실행 시간메모리
438463adamjinwei말 (IOI15_horses)C++14
17 / 100
1548 ms10316 KiB
#include <bits/stdc++.h> #include "horses.h" #define inf 1000000007 #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(""); } int n; int x[500005],y[500005]; int dp[15][1005]; int solve() { memset(dp,-0x3f,sizeof(dp)); dp[0][1]=0; for(int i=0;i<n;++i) for(int j=0;j<=1000;++j) { int nxt=j*x[i+1]; for(int k=0;k<=min(nxt,1000);++k) dp[i+1][k]=max(dp[i+1][k],(dp[i][j]+(nxt-k)*y[i+1]%mod)%mod); } int ans=0; for(int i=0;i<=1000;++i) ans=max(ans,dp[n][i]); return ans; } int init(int N,int X[],int Y[]) { n=N; for(int i=1;i<=n;++i) { x[i]=X[i-1]; y[i]=Y[i-1]; } return solve(); } int updateX(int pos,int val) { x[pos+1]=val; return solve(); } int updateY(int pos,int val) { y[pos+1]=val; return solve(); }

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

horses.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...