답안 #723138

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
723138 2023-04-13T09:08:03 Z gagik_2007 Viruses (BOI20_viruses) C++17
0 / 100
1 ms 212 KB
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <chrono>
#include <ctime>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <limits>
#include <iomanip>
#include <unordered_set>
#include <unordered_map>
#include <fstream>
#include <functional>
#include <random>
#include <cassert>
using namespace std;

typedef long long ll;
typedef long double ld;

#define ff first
#define ss second

ll ttt;
const ll INF = 9223372036854775807ll;
const ll MOD = 1e9 + 7;
const ll N = 200007;
const ll M = 307;
const ll LG = 31;
ll n, m, k;
ll len[N];
vector<pair<int, vector<int>>>a;
vector<vector<int>>abd;

int main() {
	//freopen("in.txt", "r", stdin);
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	cin >> k >> n >> m;
	for (int i = 0; i < n; i++) {
		int v;
		cin >> v;
		a.push_back({ v,{} });
		int sz;
		cin >> sz;
		for (int j = 0; j < sz; j++) {
			int x;
			cin >> x;
			a[i].ss.push_back(x);
		}
	}
	for (int i = 0; i < m; i++) {
		int sz;
		cin >> sz;
		abd.push_back({});
		for (int j = 0; j < sz; j++) {
			int x;
			cin >> x;
			abd[i].push_back(x);
		}
	}
	len[0] = len[1] = 1;
	for (int v = 2; v < k; v++) {
		len[v] = INF;
	}
	for (int _ = 0; _ <= n; _++) {
		for (int i = 0; i < n; i++) {
			ll cur = 0;
			for (int v : a[i].ss) {
				cur += len[v];
				if (len[v] == INF) {
					cur = INF;
					break;
				}
			}
			len[a[i].ff] = min(len[a[i].ff], cur);
		}
	}
	for (int v = 2; v < k; v++) {
		cout << "NO " << len[v] << endl;
	}
}

/// ---- - --------  ------ -------- -- - - -
/// Just a reminder. Ubuntu password is I O I
/// ---- - --------  ------ -------- -- - - -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -