QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#177373 | #7118. Closing Time | triple321# | Compile Error | / | / | C++20 | 2.0kb | 2023-09-12 21:53:47 | 2023-09-12 21:53:48 |
Judging History
你现在查看的是测评时间为 2023-09-12 21:53:48 的历史记录
- [2024-04-28 07:39:28]
- 管理员手动重测本题所有提交记录
- 测评结果:Compile Error
- 用时:0ms
- 内存:0kb
- [2023-09-12 21:53:48]
- 评测
- 测评结果:Compile Error
- 用时:0ms
- 内存:0kb
- [2023-09-12 21:53:47]
- 提交
answer
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#pragma GCC optimize("Ofast")
using namespace std;
using namespace __gnu_pbds;
#define lg long long
#define ordered_set tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
int max_score(int n, int x, int y, lg k, int u[], int v[], int w[])
{
int ans = 0;
x++, y++;
lg a[n+2], b[n+2], c[n+2], d[n+2];
memset(a, 0, sizeof(a));
memset(b, 0, sizeof(b));
memset(c, 0, sizeof(c));
memset(d, 0, sizeof(d));
for(int i = x-1; i >= 1; i--)
{
a[i] = a[i+1]+w[i-1];
}
for(int i = y-1; i >= 1; i--)
{
c[i] = c[i+1]+w[i-1];
}
for(int i = x+1; i <= n; i++)
{
b[i] = b[i-1]+w[i-2];
}
for(int i = y+1; i <= n; i++)
{
d[i] = d[i-1]+w[i-2];
}
lg sum = 0;
vector<lg> mxm(n+2);
for(int i = x; i >= 1; i--)
{
sum += max(0ll, a[i]-mxm[i]);
mxm[i] = max(mxm[i], a[i]);
vector<lg> fake3 = mxm;
lg o3 = sum;
for(int j = x; j <= n; j++)
{
sum += max(0ll, b[j]-mxm[j]);
mxm[j] = max(mxm[j], a[j]);
vector<lg> fake2 = mxm;
lg o2 = sum;
for(int z = y; z >= 1; z--)
{
sum += max(0ll, c[z]-mxm[z]);
mxm[z] = max(mxm[z], c[z]);
vector<lg> fake = mxm;
lg o = sum;
for(int g = y; g <= n; g++)
{
sum += max(0ll, d[g]-mxm[g]);
mxm[g] = max(mxm[g], d[g]);
// cout << i << ' ' << j << ' ' << z << ' ' << g << '\n';
// for(int i = 1; i <= n; i++) cout << mxm[i] << ' ';
// cout << '\n';
if(sum <= k)
{
ans = max(ans, (j-i+1)+(g-z+1));
}
}
sum = o;
mxm = fake;
}
mxm = fake2;
sum = o2;
}
mxm = fake3;
sum = o3;
}
return ans;
}
int main()
{
fastio;
int n, x, y;
lg k;
cin >> n >> x >> y >> k;
int u[n-1], v[n-1], w[n-1];
for(int i = 0; i+1 < n; i++)
{
cin >> u[i] >> v[i] >> w[i];
}
cout << max_score(n, x, y, k, u, v, w) << '\n';
return 0;
}
Details
/usr/bin/ld: /tmp/ccOSXd6d.o: in function `main': answer.code:(.text.startup+0x0): multiple definition of `main'; /tmp/ccXqXRUc.o:implementer.cpp:(.text.startup+0x0): first defined here /usr/bin/ld: /tmp/ccXqXRUc.o: in function `main': implementer.cpp:(.text.startup+0x775): undefined reference to `max_score(int, int, int, long long, std::vector<int, std::allocator<int> >, std::vector<int, std::allocator<int> >, std::vector<int, std::allocator<int> >)' collect2: error: ld returned 1 exit status