Submission #721992

#TimeUsernameProblemLanguageResultExecution timeMemory
721992TimDeeHomecoming (BOI18_homecoming)C++17
0 / 100
47 ms37328 KiB
// you're already the best // _ // ^ ^ // // >(O_O)<___// // \ __ __ \ // \\ \\ \\\\ #include "homecoming.h" #include <bits/stdc++.h> using namespace std; #pragma GCC optimize("O3","unroll-loops") #pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt") using ll = long long; //#define int long long //#define double long double #define forn(i,n) for(int i=0; i<(n); ++i) #define pb push_back #define pi pair<int,int> #define f first #define s second #define vii(a,n) vector<int> a(n); forn(i,n) cin>>a[i]; #define all(x) x.begin(), x.end() #define rall(x) x.rbegin(), x.rend() mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); const int inf = 1e18; const int mod = 998244353; long long solve(int N, int K, int *A, int *B) { #define int long long vector<pi> dp(N+1,{-inf,0}); vector<int> b; forn(i,N) b.pb(B[i]); forn(i,N) b.pb(B[i]); vector<int> pr(2*N+1,0); forn(i,2*N) pr[i+1]=pr[i]+b[i]; forn(i,N) { dp[i+1].f = max(dp[i].f+b[i+K-1],dp[i].s+pr[i+K]-pr[i]); dp[i+1].s = max(dp[i].f,dp[i].s); } return max(dp[N].f,dp[N].s); #undef int }

Compilation message (stderr)

homecoming.cpp:5:1: warning: multi-line comment [-Wcomment]
    5 | //   \ __ __  \
      | ^
homecoming.cpp:28:17: warning: overflow in conversion from 'double' to 'int' changes value from '1.0e+18' to '2147483647' [-Woverflow]
   28 | const int inf = 1e18;
      |                 ^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...