QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#577529 | #7118. Closing Time | Owmicron# | 0 | 26ms | 11032kb | C++17 | 2.0kb | 2024-09-20 12:24:05 | 2024-09-20 12:24:06 |
Judging History
answer
#include "closing.h"
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
int max_score(int N, int X, int Y, long long K,
std::vector<int> U, std::vector<int> V, std::vector<int> W)
{
using data = tuple<ll, int, int, int>;
priority_queue<data, vector<data>, greater<data>> pq;
vector<ll> dx(N, 0), dy(N, 0);
for(int i = X + 1; i < N; ++i) dx[i] = dx[i-1] + W[i-1];
for(int i = X - 1; i >= 0; --i) dx[i] = dx[i+1] + W[i];
for(int i = Y + 1; i < N; ++i) dy[i] = dy[i-1] + W[i-1];
for(int i = Y - 1; i >= 0; --i) dy[i] = dy[i+1] + W[i];
vector<bool> vx(N, false), vy(N, false);
int ans = 2;
vx[X] = vy[Y] = true;
vector<int> dir = {-1, 1};
for(auto &d : dir) {
if(X + d < 0 || X + d >= N) continue;
pq.emplace(dx[X+d], X+d, 0, 1);
}
for(auto &d : dir) {
if(Y + d < 0 || Y + d >= N) continue;
pq.emplace(dy[Y+d], Y+d, 0, 2);
}
ll tot = 0;
for(; !pq.empty(); ) {
auto [cost, cur, state, app] = pq.top();
pq.pop();
int mask = (vx[cur] ? 1 : 0) + (vy[cur] ? 2 : 0);
if(mask != state) continue;
if(tot + cost > K) break;
tot += cost;
++ans;
if(app == 1) {
vx[cur] = true;
for(auto &d : dir) {
if(cur + d < 0 || cur + d >= N || vx[cur + d]) continue;
ll nxt = (vy[cur + d] ? max(0LL, dy[cur + d] - dx[cur + d]) : dy[cur + d]);
int msk = (vy[cur + d] ? 2 : 0);
pq.emplace(nxt, cur + d, msk, 1);
}
}
else {
vy[cur] = true;
for(auto &d : dir) {
if(cur + d < 0 || cur + d >= N || vy[cur + d]) continue;
ll nxt = (vx[cur + d] ? max(0LL, dx[cur + d] - dy[cur + d]) : dx[cur + d]);
int msk = (vx[cur + d] ? 1 : 0);
pq.emplace(nxt, cur + d, msk, 2);
}
}
}
return ans;
}
詳細信息
Subtask #1:
score: 0
Wrong Answer
Test #1:
score: 0
Wrong Answer
time: 26ms
memory: 11032kb
input:
cc61ad56a4797fb3f5c9529f73ce6fcedd85669b 1 200000 31011 61157 8517583098 31011 129396 964383 1655 129396 331139 1655 191487 566483 110385 191487 865248 43212 110385 542661 43212 81682 13766 81682 91774 546589 91774 124706 780638 124706 175650 118706 10421 175650 615314 10421 151953 436270 140430 151...
output:
081ce3c351cbf526b37954b9ad30f2b531a7585c OK 6
result:
wrong answer 1st lines differ - on the 1st token, expected: '451', found: '6'
Subtask #2:
score: 0
Wrong Answer
Test #4:
score: 0
Wrong Answer
time: 0ms
memory: 3828kb
input:
cc61ad56a4797fb3f5c9529f73ce6fcedd85669b 1 50 23 25 382806473 0 1 375710 1 2 898637 2 3 10402 3 4 536577 4 5 385023 5 6 71075 6 7 543368 7 8 301497 8 9 174394 9 10 711312 10 11 923006 11 12 675532 12 13 838667 13 14 565729 14 15 979816 15 16 862618 16 17 576015 17 18 177751 18 19 306989 19 20 881492...
output:
081ce3c351cbf526b37954b9ad30f2b531a7585c OK 52
result:
wrong answer 1st lines differ - on the 1st token, expected: '96', found: '52'
Subtask #3:
score: 0
Skipped
Dependency #2:
0%
Subtask #4:
score: 0
Skipped
Dependency #3:
0%
Subtask #5:
score: 0
Wrong Answer
Test #36:
score: 0
Wrong Answer
time: 0ms
memory: 4116kb
input:
cc61ad56a4797fb3f5c9529f73ce6fcedd85669b 1 4 0 1 9 0 2 2 1 2 3 2 3 3
output:
081ce3c351cbf526b37954b9ad30f2b531a7585c OK 3
result:
wrong answer 1st lines differ - on the 1st token, expected: '6', found: '3'
Subtask #6:
score: 0
Skipped
Dependency #2:
0%
Subtask #7:
score: 0
Skipped
Dependency #3:
0%
Subtask #8:
score: 0
Skipped
Dependency #4:
0%
Subtask #9:
score: 0
Skipped
Dependency #1:
0%