이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
/*
*  In the name of God
*
*  Author: Farbod Doost
*  Last Modified: Sun, 06 Nov 2022 (12:53:00)
*
*/
#include <iostream>
#include <vector>
using namespace std;
const int N = 1e5 + 1;
int n, m, dp[N];
bool vis[N];
vector <int> adj[N];
signed main()
{
    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    int q;
	cin >> n >> m >> q;
	for (int i = 0; i < m; i++) {
		int u, v;
		cin >> u >> v, u--, v--;
		adj[u].push_back(v);
	}
	int r;
	while (q--) {
		int k, c;
		cin >> r >> k, r--;
		for (int i = 0; i < k; i++)
			cin >> c, vis[c - 1] = 1;
	}
	dp[r] = 0;
	for (int i = r - 1; i >= 0; i--) {
		dp[i] = -1;
		for (auto x: adj[i])
			if (x <= r & dp[x] != -1)
				dp[i] = max(dp[i], dp[x] + 1);
	}
	int ans = -1;
	for (int i = 0; i <= r; i++)
		if (!vis[i])
			ans = max(ans, dp[i]);
	cout << ans;
    return 0;
}
컴파일 시 표준 에러 (stderr) 메시지
bitaro.cpp: In function 'int main()':
bitaro.cpp:45:10: warning: suggest parentheses around comparison in operand of '&' [-Wparentheses]
   45 |    if (x <= r & dp[x] != -1)
      |        ~~^~~~| # | Verdict | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict | Execution time | Memory | Grader output | 
|---|
| Fetching results... |