| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 724564 | TimDee | Homecoming (BOI18_homecoming) | C++17 | 1006 ms | 52952 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
// 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
const int inf = 1e18;
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];
vector<int> a;
forn(i,N) a.pb(A[i]);
forn(i,N) a.pb(A[i]);
vector<int> pra(2*N+1,0);
forn(i,2*N) pra[i+1]=pra[i]+a[i];
vector<int> dp(2*N+1,0);
forn(i,K) cout<<dp[i]<<' ';
for (int i=K; i<=2*N; ++i) {
dp[i]=max(dp[i],dp[i-1]);
int sub = (i>=N)?dp[i-N]:0;
for (int j=max(0ll,i-N); j<=i-K; ++j) {
dp[i]=max(dp[i],dp[j]-sub+(pra[i-K+1]-pra[j])-(pr[i]-pr[j]));
}
}
return dp[2*N];
#undef int
}컴파일 시 표준 에러 (stderr) 메시지
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
