提交记录 14023
| 用户 | 题目 | 状态 | 得分 | 用时 | 内存 | 语言 | 代码长度 |
|---|---|---|---|---|---|---|---|
| wlzhouzhuan | 2003. 【NOI2020】美食家(加强版) | Runtime Error | 0 | 89.19 us | 40 KB | C++ | 3.00 KB |
| 提交时间 | 评测时间 |
|---|---|
| 2020-08-21 21:19:23 | 2020-08-21 21:19:33 |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
static inline void upd(ll& x, const ll y) {
if (y > x)
x = y;
}
static int n, m, c[52];
struct Edge {
char u, v, w;
} e[502];
struct Event {
int t, x, y;
bool operator <(const Event& rhs) const {
return t < rhs.t;
}
} q[205];
static ll pool[233333][52];
static ll (*buf)[52] = &pool[0];
static int xjj;
struct Pre {
ll (*dp)[52];
int orig, anot; ll dx;
void init(int s) {
dp = buf;
memset(dp, 0xcc, sizeof(*dp) * 5);
dp[0][s] = 0;
vector<ull> hs;
for (int i = 0;; i++) {
for (int j = 0; j < n; j++)
dp[i][j] += c[j];
ull h = 0;
for (int j = 0; j < n; j++)
h ^= (j + 1) * (ull) (dp[i][j] - dp[i][s]);
hs.push_back(h);
if (xjj) {
if (i > xjj + 5 && !memcmp(hs.data() + i - xjj - 5, hs.data() + i - 5, 5 * sizeof(ull))) {
orig = i - xjj;
anot = i;
break;
}
} else {
for (int j = 5; j + 5 < i; j++)
if (!memcmp(hs.data() + i - 5, hs.data() + j - 5, 5 * sizeof(ull))) {
orig = j;
anot = i;
goto ok;
}
}
memset(dp + i + 5, 0xcc, sizeof(*dp));
for (int j = 0; j < m; j++)
upd(dp[i + e[j].w][e[j].v], dp[i][e[j].u]);
}
ok:;
dx = dp[anot][s] - dp[orig][s];
xjj = anot - orig;
buf += anot;
// fprintf(stderr, "pre %d, orig %d, anot %d, dx %lld\n", s, orig, anot, dx);
}
ll query(int T, int t) {
if (T < anot)
return dp[T][t];
return dp[orig + (T - orig) % xjj][t] + (T - orig) / xjj * dx;
}
} pre[52];
static ll calc(int s, int t, int T) {
return pre[s].query(T, t) - c[t];
}
int main() {
#ifdef ONLINE_JUDGE
freopen("delicacy.in", "r", stdin);
freopen("delicacy.out", "w", stdout);
#endif
int T, k;
cin >> n >> m >> T >> k;
for (int i = 0; i < n; i++)
cin >> c[i];
for (int i = 0; i < m; i++) {
int u, v, w;
cin >> u >> v >> w;
e[i].u = u - 1; e[i].v = v - 1; e[i].w = w;
}
for (int i = 0; i < n; i++)
pre[i].init(i);
cerr << "Loop length " << xjj << ", weight " << pre[0].dx << endl;
for (int i = 1; i <= k; i++) {
cin >> q[i].t >> q[i].x >> q[i].y;
q[i].x--;
}
sort(q + 1, q + k + 1);
q[0].t = 0; q[0].x = 0; q[0].y = 0;
q[k + 1].t = T; q[k + 1].x = 0; q[k + 1].y = c[0];
static ll dp[205];
memset(dp, 0xcc, sizeof(dp));
dp[0] = 0;
for (int i = 1; i <= k + 1; i++) {
for (int j = 0; j < i; j++)
upd(dp[i], dp[j] + calc(q[j].x, q[i].x, q[i].t - q[j].t));
dp[i] += q[i].y;
}
upd(dp[k + 1], -1);
cout << dp[k + 1] << endl;
return 0;
}
| Compilation | N/A | N/A | Compile OK | Score: N/A | 显示更多 |
| Subtask #1 Testcase #1 | 82.22 us | 40 KB | Runtime Error | Score: 0 | 显示更多 |
| Subtask #1 Testcase #2 | 89.19 us | 40 KB | Runtime Error | Score: 0 | 显示更多 |
| Subtask #1 Testcase #3 | 88.79 us | 40 KB | Runtime Error | Score: 0 | 显示更多 |
| Subtask #1 Testcase #4 | 83.02 us | 40 KB | Runtime Error | Score: 0 | 显示更多 |
| Subtask #1 Testcase #5 | 83.34 us | 40 KB | Runtime Error | Score: 0 | 显示更多 |
| Subtask #1 Testcase #6 | 82.25 us | 40 KB | Runtime Error | Score: 0 | 显示更多 |
| Subtask #1 Testcase #7 | 83.17 us | 40 KB | Runtime Error | Score: 0 | 显示更多 |
| Subtask #1 Testcase #8 | 82.74 us | 40 KB | Runtime Error | Score: 0 | 显示更多 |
| Subtask #1 Testcase #9 | 84.16 us | 40 KB | Runtime Error | Score: 0 | 显示更多 |
| Subtask #1 Testcase #10 | 82.49 us | 40 KB | Runtime Error | Score: 0 | 显示更多 |
| Subtask #1 Testcase #11 | 82.54 us | 40 KB | Runtime Error | Score: 0 | 显示更多 |
| Subtask #1 Testcase #12 | 83.27 us | 40 KB | Runtime Error | Score: 0 | 显示更多 |
| Subtask #1 Testcase #13 | 82.71 us | 40 KB | Runtime Error | Score: 0 | 显示更多 |
| Subtask #1 Testcase #14 | 81.78 us | 40 KB | Runtime Error | Score: 0 | 显示更多 |
| Subtask #1 Testcase #15 | 84.35 us | 40 KB | Runtime Error | Score: 0 | 显示更多 |
| Subtask #1 Testcase #16 | 82.4 us | 40 KB | Runtime Error | Score: 0 | 显示更多 |
| Subtask #1 Testcase #17 | 83.43 us | 40 KB | Runtime Error | Score: 0 | 显示更多 |
| Subtask #1 Testcase #18 | 81.59 us | 40 KB | Runtime Error | Score: 0 | 显示更多 |
| Subtask #1 Testcase #19 | 82.39 us | 40 KB | Runtime Error | Score: 0 | 显示更多 |
| Subtask #1 Testcase #20 | 81.9 us | 40 KB | Runtime Error | Score: 0 | 显示更多 |
| Subtask #1 Testcase #21 | 84.47 us | 40 KB | Runtime Error | Score: 0 | 显示更多 |
| Subtask #1 Testcase #22 | 82.35 us | 40 KB | Runtime Error | Score: 0 | 显示更多 |
| Subtask #1 Testcase #23 | 82.96 us | 40 KB | Runtime Error | Score: 0 | 显示更多 |
| Subtask #1 Testcase #24 | 82.31 us | 40 KB | Runtime Error | Score: 0 | 显示更多 |
| Subtask #1 Testcase #25 | 82.42 us | 40 KB | Runtime Error | Score: 0 | 显示更多 |
| Subtask #1 Testcase #26 | 82.68 us | 40 KB | Runtime Error | Score: 0 | 显示更多 |
| Subtask #1 Testcase #27 | 82.52 us | 40 KB | Runtime Error | Score: 0 | 显示更多 |
| Subtask #1 Testcase #28 | 81.97 us | 40 KB | Runtime Error | Score: 0 | 显示更多 |
| Subtask #1 Testcase #29 | 82.29 us | 40 KB | Runtime Error | Score: 0 | 显示更多 |
| Subtask #1 Testcase #30 | 82.22 us | 40 KB | Runtime Error | Score: 0 | 显示更多 |
| Subtask #1 Testcase #31 | 82.99 us | 40 KB | Runtime Error | Score: 0 | 显示更多 |
| Subtask #1 Testcase #32 | 82.34 us | 40 KB | Runtime Error | Score: 0 | 显示更多 |
| Subtask #1 Testcase #33 | 82.11 us | 40 KB | Runtime Error | Score: 0 | 显示更多 |
| Subtask #1 Testcase #34 | 82.02 us | 40 KB | Runtime Error | Score: 0 | 显示更多 |
| Subtask #1 Testcase #35 | 84.01 us | 40 KB | Runtime Error | Score: 0 | 显示更多 |
| Subtask #1 Testcase #36 | 82.56 us | 40 KB | Runtime Error | Score: 0 | 显示更多 |
| Subtask #1 Testcase #37 | 81.44 us | 40 KB | Runtime Error | Score: 0 | 显示更多 |
| Subtask #1 Testcase #38 | 82.41 us | 40 KB | Runtime Error | Score: 0 | 显示更多 |
| Subtask #1 Testcase #39 | 82.91 us | 40 KB | Runtime Error | Score: 0 | 显示更多 |
| Subtask #1 Testcase #40 | 83.65 us | 40 KB | Runtime Error | Score: 0 | 显示更多 |
| Subtask #1 Testcase #41 | 82.2 us | 40 KB | Runtime Error | Score: 0 | 显示更多 |
| Subtask #1 Testcase #42 | 82.87 us | 40 KB | Runtime Error | Score: 0 | 显示更多 |
| Subtask #1 Testcase #43 | 82.48 us | 40 KB | Runtime Error | Score: 0 | 显示更多 |
| Subtask #1 Testcase #44 | 81.42 us | 40 KB | Runtime Error | Score: 0 | 显示更多 |
| Subtask #1 Testcase #45 | 82.37 us | 40 KB | Runtime Error | Score: 0 | 显示更多 |
| Subtask #1 Testcase #46 | 83.97 us | 40 KB | Runtime Error | Score: 0 | 显示更多 |
| Subtask #1 Testcase #47 | 82.13 us | 40 KB | Runtime Error | Score: 0 | 显示更多 |
| Subtask #1 Testcase #48 | 82.62 us | 40 KB | Runtime Error | Score: 0 | 显示更多 |
| Subtask #1 Testcase #49 | 82.99 us | 40 KB | Runtime Error | Score: 0 | 显示更多 |
| Subtask #1 Testcase #50 | 82.88 us | 40 KB | Runtime Error | Score: 0 | 显示更多 |
Judge Duck Online | 评测鸭在线
Server Time: 2026-03-23 06:58:27 | Loaded in 2 ms | Server Status
个人娱乐项目,仅供学习交流使用 | 捐赠