QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#116096 | #6659. 외곽 순환 도로 2 | hos_lyric# | 0 | 17ms | 10684kb | C++14 | 2.1kb | 2023-06-28 09:30:15 | 2024-08-26 15:49:26 |
Judging History
你现在查看的是最新测评结果
- [2024-05-31 14:20:32]
- 评测
- 测评结果:Compile Error
- 用时:0ms
- 内存:0kb
- [2023-08-10 23:21:45]
- System Update: QOJ starts to keep a history of the judgings of all the submissions.
- [2023-06-28 09:30:15]
- 提交
answer
#include <cassert>
#include <cmath>
#include <cstdint>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <functional>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
using namespace std;
using Int = long long;
template <class T1, class T2> ostream &operator<<(ostream &os, const pair<T1, T2> &a) { return os << "(" << a.first << ", " << a.second << ")"; };
template <class T> ostream &operator<<(ostream &os, const vector<T> &as) { const int sz = as.size(); os << "["; for (int i = 0; i < sz; ++i) { if (i >= 256) { os << ", ..."; break; } if (i > 0) { os << ", "; } os << as[i]; } return os << "]"; }
template <class T> void pv(T a, T b) { for (T i = a; i != b; ++i) cerr << *i << " "; cerr << endl; }
template <class T> bool chmin(T &t, const T &f) { if (t > f) { t = f; return true; } return false; }
template <class T> bool chmax(T &t, const T &f) { if (t < f) { t = f; return true; } return false; }
constexpr Int INF = 1001001001001001001LL;
int N, K;
vector<int> P;
vector<Int> C, W;
Int ans;
namespace sub2 {
void run() {
assert(K == N - 1);
// do not use (K-1)-0
{
vector<Int> dp(K + 1, INF);
dp[0] = 0;
for (int i = 1; i <= K; ++i) {
if (i - 1 >= 0) chmin(dp[i], dp[i - 1] + W[i]);
if (i - 2 >= 0) chmin(dp[i], dp[i - 2] + C[i - 1]);
}
chmin(ans, dp[K]);
}
// use (K-1)-0
{
vector<Int> dp(K + 1, INF);
dp[1] = C[0];
for (int i = 2; i <= K - 1; ++i) {
if (i - 1 >= 1) chmin(dp[i], dp[i - 1] + W[i]);
if (i - 2 >= 1) chmin(dp[i], dp[i - 2] + C[i - 1]);
}
chmin(ans, dp[K - 1]);
}
}
} // sub2
long long place_police(vector<int> P_, vector<long long> C_, vector<long long> W_) {
P = P_;
C = C_;
W = W_;
N = (int)P.size() + 1;
K = W.size();
ans = INF;
if (P == vector<int>(N - 1, 0)) {
sub2::run();
}
return ans;
}
Details
Tip: Click on the bar to expand more detailed information
Subtask #1:
score: 0
Wrong Answer
Test #1:
score: 6
Accepted
time: 0ms
memory: 3796kb
input:
5 0 452912 0 820899 0 79369 0 232463 1000000000000 1000000000000 1000000000000 1000000000000
output:
532281
result:
ok single line: '532281'
Test #2:
score: 0
Wrong Answer
time: 0ms
memory: 4056kb
input:
6 0 581451 0 68556 0 918465 0 661406 0 41816 1000000000000 1000000000000 1000000000000 1000000000000 1000000000000
output:
729995
result:
wrong answer 1st lines differ - expected: '1000000110372', found: '729995'
Subtask #2:
score: 0
Wrong Answer
Test #28:
score: 8
Accepted
time: 17ms
memory: 10528kb
input:
99997 0 122727 0 267270 0 846212 0 454122 0 805668 0 614161 0 7805 0 173284 0 684707 0 269129 0 930945 0 1101 0 992427 0 297412 0 759787 0 227130 0 120418 0 90914 0 333684 0 46144 0 519912 0 171490 0 823586 0 121787 0 674177 0 560254 0 753090 0 853359 0 465464 0 655527 0 631303 0 919012 0 597126 0 1...
output:
24980330181
result:
ok single line: '24980330181'
Test #29:
score: 8
Accepted
time: 17ms
memory: 10684kb
input:
99997 0 122727 0 267270 0 846212 0 454122 0 805668 0 614161 0 7805 0 173284 0 684707 0 269129 0 930945 0 1101 0 992427 0 297412 0 759787 0 227130 0 120418 0 90914 0 333684 0 46144 0 519912 0 171490 0 823586 0 121787 0 674177 0 560254 0 753090 0 853359 0 465464 0 655527 0 631303 0 919012 0 597126 0 1...
output:
24980330181
result:
ok single line: '24980330181'
Test #30:
score: 0
Wrong Answer
time: 16ms
memory: 10468kb
input:
99998 0 792854 0 622829 0 836127 0 847372 0 71732 0 241096 0 487224 0 696890 0 899047 0 845614 0 27226 0 270985 0 698890 0 64699 0 856738 0 685434 0 766150 0 540443 0 802763 0 874879 0 250532 0 834015 0 616087 0 771638 0 262098 0 458015 0 959723 0 408130 0 880649 0 456673 0 923653 0 969100 0 439032 ...
output:
25076796605
result:
wrong answer 1st lines differ - expected: '1025006589524', found: '25076796605'
Subtask #3:
score: 0
Wrong Answer
Test #36:
score: 0
Wrong Answer
time: 0ms
memory: 4068kb
input:
11 0 9 0 8 2 0 3 7 3 1 2 6 0 0 7 7 7 1 9 6 1000000000000 1000000000000 1000000000000 1000000000000 1000000000000 1000000000000
output:
1001001001001001001
result:
wrong answer 1st lines differ - expected: '1', found: '1001001001001001001'
Subtask #4:
score: 0
Skipped
Dependency #3:
0%
Subtask #5:
score: 0
Wrong Answer
Test #77:
score: 0
Wrong Answer
time: 7ms
memory: 5308kb
input:
50311 0 962897543825 1 887020369743 2 363658802934 3 481009844166 4 1099712574 5 858320882162 6 521927434762 7 379344260539 8 73024776148 9 634183458545 10 869560347910 11 81581323331 12 750044298516 13 307013017409 14 306226274039 15 423923546601 16 482114694167 17 849292461119 18 299993045938 19 7...
output:
1001001001001001001
result:
wrong answer 1st lines differ - expected: '939418184213', found: '1001001001001001001'
Subtask #6:
score: 0
Skipped
Dependency #1:
0%