QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#124117 | #6342. Security Guard | Adam_GS# | 0 | 38ms | 17584kb | C++17 | 806b | 2023-07-14 08:23:15 | 2024-07-04 00:39:21 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(a, b) for(int a = 0; a < (b); ++a)
#define st first
#define nd second
#define pb push_back
#define all(a) a.begin(), a.end()
const int LIM=2e5+7;
ll T[LIM], odw[LIM], ans;
vector<int>V[LIM];
int main() {
ios_base::sync_with_stdio(0); cin.tie(0);
int n, m, q;
cin >> n >> m >> q;
rep(i, n) cin >> T[i];
rep(i, m) {
int a, b;
cin >> a >> b; --a; --b;
V[a].pb(b);
V[b].pb(a);
}
pair<ll,int>ma={-1, -1};
rep(i, n) ma=max(ma, {T[i], i});
priority_queue<pair<ll,ll>>Q;
Q.push({0, -ma.nd});
while(!Q.empty()) {
ll o=-Q.top().st, p=-Q.top().nd; Q.pop();
if(odw[p]) continue;
odw[p]=1;
ans+=o;
for(auto i : V[p]) if(!odw[i]) Q.push({T[p], -i});
}
cout << ans << '\n';
}
詳細信息
Subtask #1:
score: 0
Wrong Answer
Test #1:
score: 0
Wrong Answer
time: 38ms
memory: 17584kb
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:
wrong answer 1st numbers differ - expected: '199999', found: '-199999'
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
Wrong Answer
Test #85:
score: 0
Wrong Answer
time: 0ms
memory: 9756kb
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:
-14113958700
result:
wrong answer 1st numbers differ - expected: '14113958700', found: '-14113958700'
Subtask #6:
score: 0
Skipped
Dependency #5:
0%
Subtask #7:
score: 0
Skipped
Dependency #1:
0%