QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#84878 | #5663. Tangle: A DAG for storing transactions | piasticOuO# | Compile Error | / | / | C++14 | 978b | 2023-03-06 20:33:03 | 2023-03-06 20:33:11 |
Judging History
你现在查看的是最新测评结果
- [2023-08-10 23:21:45]
- System Update: QOJ starts to keep a history of the judgings of all the submissions.
- [2023-03-06 20:33:11]
- 评测
- 测评结果:Compile Error
- 用时:0ms
- 内存:0kb
- [2023-03-06 20:33:03]
- 提交
answer
#include <iostream>
#include <queue>
using namespace std;
const int maxn = 1e4 + 5;
int n, x, X;
int can[maxn][3], w[maxn], ans[maxn];
bool used[maxn];
queue<int> q;
void bfs(int x) {
memset(used, 0, sizeof(used));
q.push(x);
ans[x] += w[x];
while (!q.empty()) {
int p = q.front();
q.pop();
int uu = can[p][1];
if (!used[uu]) {
used[uu] = true;
ans[uu] += w[x];
q.push(uu);
}
int vv = can[p][2];
if (!used[vv]) {
used[vv] = true;
ans[vv] += w[x];
q.push(vv);
}
}
}
void solve() {
cin >> n >> X;
can[1][1] = 0;
can[1][2] = 0;
for (int i = 1; i <= n; ++i) {
cin >> x >> can[x][1] >> can[x][2] >> w[x];
}
for (int i = 2; i <= n + 1; ++i) {
bfs(i);
}
int num = 0;
for (int i = 2; i <= n; ++i) {
if (ans[i] >= X) {
cout << i << " " << ans[i] << "\n";
num ++;
}
}
cout << num;
}
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
solve();
return 0;
}
详细
answer.code: In function ‘void bfs(int)’: answer.code:12:9: error: ‘memset’ was not declared in this scope 12 | memset(used, 0, sizeof(used)); | ^~~~~~ answer.code:3:1: note: ‘memset’ is defined in header ‘<cstring>’; did you forget to ‘#include <cstring>’? 2 | #include <queue> +++ |+#include <cstring> 3 | using namespace std;