# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1111252 | codexistent | Pipes (BOI13_pipes) | C++14 | 289 ms | 131072 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define MAXN 100005
#define MAXM 500005
#define FOR(i, a, b) for(ll i = a; i <= b; i++)
#define f first
#define s second
ll n, m, t[MAXN], en[MAXN], r[MAXM];
pair<ll, ll> e[MAXM];
vector<pair<ll, ll>> adj[MAXN];
bool v[MAXN];
int main(){
cin >> n >> m;
FOR(i, 1, n) {
cin >> t[i];
en[i] = 0, v[i] = false;
}
FOR(i, 1, m){
cin >> e[i].f >> e[i].s;
adj[e[i].f].push_back({e[i].s, i}), en[e[i].f]++;
adj[e[i].s].push_back({e[i].f, i}), en[e[i].s]++;
r[i] = 1000000001;
}
if(!(m == n - 1 || m == n)) return cout << 0 << endl, 0;
queue<ll> q;
FOR(i, 1, n) if(en[i] == 1) q.push(i);
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |