# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
974003 |
2024-05-02T14:56:18 Z |
NotLinux |
Viruses (BOI20_viruses) |
C++17 |
|
228 ms |
262144 KB |
//author : FatihCihan
#include <bits/stdc++.h>
using namespace std;
#define all(v) v.begin() , v.end()
#define sz(a) (int)a.size()
const int N = 1e5 + 7;
const int inf = 1e9 + 7;
int g,n,m,dp[N];
vector < int > mutation[N+1] , bruh[N+1];
int f(int x){
if(dp[x] != inf)return dp[x];
for(auto itr : bruh[x]){
int local_ans = 0;
for(auto itr1 : mutation[itr]){
if(itr1 == x){
local_ans = inf;
break;
}
else{
local_ans += f(itr1);
}
}
dp[x] = min(dp[x] , local_ans);
}
// for(auto itr : bruh[x]){
// for(auto itr1 : mutation[itr]){
// cout << itr1 << " ";
// }
// cout << endl;
// }
// cout << x << " : " << dp[x] << endl;
return dp[x];
}
void solve(){
for(int i = 0;i<N;i++)dp[i] = inf;
cin >> g >> n >> m;
for(int i = 0;i<n;i++){
int a,k;
cin >> a >> k;
bruh[a].push_back(i);
mutation[i].resize(k);
for(int j = 0;j<k;j++){
cin >> mutation[i][j];
}
}
dp[0] = dp[1] = 1;
for(int i = 2;i<=g-1;i++){
cout << "NO " << f(i) << '\n';
}
}
signed main(){
ios_base::sync_with_stdio(0);cin.tie(0);
int testcase = 1;//cin >> testcase;
while(testcase--)solve();
cerr << 1000.0 * clock() / CLOCKS_PER_SEC << " ms" << endl;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
228 ms |
262144 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
228 ms |
262144 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
37 ms |
5464 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
228 ms |
262144 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
228 ms |
262144 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |