# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1127074 | Agageldi | Pipes (BOI13_pipes) | C++20 | 18 ms | 16968 KiB |
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define N 400005
#define ff first
#define ss second
#define pb push_back
#define sz(s) (int)s.size()
#define rep(c, a, b) for(c = a; c <= b; c++)
ll n, m, vis[N], a[N], vip[3000][3000], viss[N];
vector <int> v[N];
vector <pair <int,int>> ans;
void solve(int x) {
viss[x] = 1;
for(auto i : v[x]) {
if(viss[i]) continue;
solve(i);
ans.pb({vip[x][i],vis[i]});
vis[x] -= vis[a[i]];
}
}
int main () {
ios::sync_with_stdio(0);cin.tie(0);
cin >> n >> m;
for(int i = 1;i <= n; i++) {
cin >> a[i];
vis[i] = a[i];
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |