QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#691148 | #6342. Security Guard | L_Hospital_# | 0 | 32ms | 27104kb | C++14 | 777b | 2024-10-31 10:08:11 | 2024-10-31 10:08:12 |
Judging History
answer
#include<bits/stdc++.h>
# define int long long
# define rep(i, j, k) for (int i = j; i <= k; ++i)
using namespace std;
int n, m, q, s[200005];
int hd[400005], to[400005], nxt[400005], etimer;
int ans, maxx;
void addedge(int u, int v){to[++etimer] = v, nxt[etimer] = hd[u], hd[u] = etimer;}
void dfs(int u, int fa)
{
for (int i = hd[u]; i; i = nxt[i]) if (to[i] != fa) ans += s[u], dfs(to[i], u);
}
signed main()
{
// freopen("ex_4.in", "r", stdin);
// freopen("a.out", "w", stdout);
ios::sync_with_stdio(false); cin.tie(0), cout.tie(0);
cin >> n >> m >> q;
rep(i, 1, n) {cin >> s[i]; if (s[i] > s[maxx]) maxx = s[i];}
rep(i, 1, m) {int u, v; cin >> u >> v; addedge(u, v), addedge(v, u);}
dfs(maxx, 0);
cout << ans << endl;
return 0;
}
詳細信息
Subtask #1:
score: 0
Wrong Answer
Test #1:
score: 12
Accepted
time: 23ms
memory: 26720kb
input:
200000 199999 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...
output:
199999
result:
ok 1 number(s): "199999"
Test #2:
score: 12
Accepted
time: 30ms
memory: 25516kb
input:
200000 199999 0 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 ...
output:
399998
result:
ok 1 number(s): "399998"
Test #3:
score: 12
Accepted
time: 29ms
memory: 26248kb
input:
200000 199999 0 1 2 1 1 1 2 2 1 2 1 1 2 2 2 2 1 1 2 1 1 1 1 2 2 2 1 1 2 2 1 1 1 2 1 1 2 1 1 1 1 1 1 1 2 1 2 2 1 2 1 1 2 1 2 2 2 2 1 2 2 1 2 1 2 2 2 1 1 1 2 1 1 1 2 2 1 1 1 2 2 2 2 1 1 2 2 1 1 2 1 2 1 2 1 2 1 2 1 1 2 1 2 1 2 1 2 1 1 2 1 1 1 2 2 2 1 2 1 1 1 2 1 2 2 2 1 2 1 1 1 1 2 2 1 1 2 1 2 1 2 1 2 ...
output:
299700
result:
ok 1 number(s): "299700"
Test #4:
score: 12
Accepted
time: 29ms
memory: 27104kb
input:
200000 199999 0 2 2 1 2 1 2 2 2 1 1 2 2 1 2 1 2 1 1 2 2 2 2 1 1 2 2 2 1 1 1 1 1 2 2 1 2 2 2 2 1 2 1 2 2 1 1 2 1 1 2 2 2 1 1 2 2 2 2 2 2 2 2 1 2 2 2 1 2 2 2 2 2 2 2 1 1 1 2 1 1 1 1 2 1 1 1 2 2 2 2 1 2 2 2 1 1 1 2 1 2 2 1 2 1 1 1 1 2 1 1 1 1 1 2 1 2 1 2 2 2 2 2 1 2 2 1 2 1 2 1 1 2 1 2 2 1 2 2 1 2 1 1 ...
output:
300131
result:
ok 1 number(s): "300131"
Test #5:
score: 12
Accepted
time: 22ms
memory: 26052kb
input:
200000 199999 0 1 2 2 1 1 1 1 2 2 1 2 2 1 2 1 1 1 1 2 1 1 2 1 1 1 1 2 1 1 1 1 2 2 2 1 2 1 1 2 1 2 2 1 1 2 2 2 2 1 2 1 2 2 1 1 1 2 1 1 2 1 1 2 2 1 2 2 2 2 2 1 2 2 2 1 2 2 1 1 2 2 2 1 2 2 2 1 1 2 1 2 2 2 1 2 2 1 2 1 1 2 1 2 2 2 1 2 1 1 1 1 2 1 1 1 2 1 2 2 2 1 2 2 1 2 1 1 1 1 1 2 1 1 2 1 2 1 1 2 2 2 2 ...
output:
300132
result:
ok 1 number(s): "300132"
Test #6:
score: 0
Wrong Answer
time: 32ms
memory: 27016kb
input:
200000 199999 0 2 1 1 2 2 2 1 1 2 2 1 2 2 2 1 1 1 2 1 2 2 1 1 1 1 2 1 2 1 1 1 1 2 2 1 1 1 1 2 1 2 2 2 2 1 1 1 1 2 2 2 1 1 2 2 2 1 2 2 2 1 1 1 1 1 1 1 2 2 2 2 1 2 2 1 2 1 1 1 2 2 1 2 2 1 1 1 2 2 2 2 2 2 2 2 1 1 2 1 2 2 1 2 1 2 1 1 1 1 2 1 1 2 2 2 2 1 1 1 2 1 2 1 1 1 1 2 1 1 1 1 1 1 2 1 2 1 2 1 2 1 1 ...
output:
300093
result:
wrong answer 1st numbers differ - expected: '300094', found: '300093'
Subtask #2:
score: 0
Skipped
Dependency #1:
0%
Subtask #3:
score: 0
Skipped
Dependency #2:
0%
Subtask #4:
score: 0
Skipped
Dependency #3:
0%
Subtask #5:
score: 0
Runtime Error
Test #85:
score: 0
Runtime Error
input:
16 15 200000 692461146 622302385 805066691 422290641 600839873 940930580 873147413 489653843 239129952 383473127 21389393 913787109 856138328 859082963 262475462 327598064 6 13 6 9 6 15 6 14 6 16 6 8 5 6 1 6 4 6 3 6 6 11 6 7 6 10 2 6 6 12
output:
result:
Subtask #6:
score: 0
Skipped
Dependency #5:
0%
Subtask #7:
score: 0
Skipped
Dependency #1:
0%