This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
// oooo
/*
har chi delet mikhad bebar ~
gitar o ba khodet nabar! ~
;Amoo_Hasan;
*/
#include<bits/stdc++.h>
//#pragma GCC optimize("O3,no-stack-protector,unroll-loops")
//#pragma GCC target("avx2,fma")
using namespace std;
typedef long long ll;
typedef long double ld;
#define Sz(x) int((x).size())
#define All(x) (x).begin(), (x).end()
#define wtf(x) cout<<#x <<" : " <<x <<endl
constexpr ll inf = 1e18, N = 2e7 + 10;
int a[N], k[N];
int b[2][N];
ll dp[N];
vector<int> vc[N], ind[N];
int main() {
ios :: sync_with_stdio(0), cin.tie(0);
int g, n, m; cin >>g >>n >>m;
for(int i = 0; i < n; i++) {
cin >>a[i] >>k[i];
for(int j = 0; j < k[i]; j++) {
cin >>b[i][j];
}
ind[a[i]].push_back(i);
}
for(int i = 0; i < m; i++) {
int s; cin >>s;
for(int j = 0; j < s; j++) {
int u; cin >>u;
vc[i].push_back(u);
}
}
assert(m == 0);
for(int i = 0; i < N; i++) dp[i] = 100000000000000ll;
dp[0] = dp[1] = 1;
for(int tim = 0; tim < N; tim++) {
for(int i = 0; i < n; i++) {
ll cnt = 0;
for(int j = 0; j < k[i]; j++) {
cnt += dp[b[i][j]];
}
dp[a[i]] = min(dp[a[i]], cnt);
}
}
for(int i = 2; i < g; i++) {
cout<<"NO " <<dp[i] <<endl;
}
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |