Submission #600862

# Submission time Handle Problem Language Result Execution time Memory
600862 2022-07-21T08:37:30 Z Arnch Viruses (BOI20_viruses) C++17
0 / 100
700 ms 1108 KB
// 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);

	for(int i = 0; i < N; i++) dp[i] = 100000000000000ll;
	dp[0] = dp[1] = 1;

	for(int tim = 0; tim < N * 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
1 Execution timed out 1096 ms 724 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1096 ms 724 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 2 ms 1108 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1096 ms 724 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1096 ms 724 KB Time limit exceeded
2 Halted 0 ms 0 KB -