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 = 2e3 + 10;
int a[N], k[N];
int b[N][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);
memset(dp, 63, sizeof(dp));
for(int i = 2; i < g; i++) {
for(auto j : ind[i]) {
ll cnt = 0;
for(int t = 0; t < k[j]; t++) {
if(b[j][t] < 2) cnt++;
else cnt += dp[b[j][t]];
}
dp[i] = min(dp[i], cnt);
}
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... |