QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#116096 | #6659. 외곽 순환 도로 2 | hos_lyric# | Compile Error | / | / | C++14 | 2.1kb | 2023-06-28 09:30:15 | 2024-05-31 14:20:32 |
Judging History
你现在查看的是测评时间为 2024-05-31 14:20:32 的历史记录
- [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
cc1plus: fatal error: implementer.cpp: No such file or directory compilation terminated.