| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 992446 | n3rm1n | Bitaro’s Party (JOI18_bitaro) | C++17 | 2 ms | 6488 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
#define endl '\n'
#define ll long long
using namespace std;
const int MAXN = 2e5 + 10;
void speed()
{
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
}
int n, m, q;
vector < int > g[MAXN];
int dp[MAXN];
int tt, yy;
int marked[MAXN];
void read()
{
cin >> n >> m >> q;
int from, to;
for (int i = 1; i <= m; ++ i)
{
cin >> from >> to;
g[from].push_back(to);
}
dp[1] = 0;
for (int i = 1; i <= n; ++ i)
{
for (int j = 0; j < g[i].size(); ++ j)
dp[i] = max(dp[i], dp[g[i][j]]);
}
while(q --)
{
cin >> tt >> yy;
int x;
memset(marked, 0, sizeof(marked));
for (int i = 1; i <= yy; ++ i)
{
cin >> x;
marked[x] = 1;
}
int maxx = 0;
for (int i = tt; i >= 1; -- i)
{
if(i == tt)continue;
for (int j = 0; j < g[i].size(); ++ j)
{
int nb = g[i][j];
dp[i] = max(dp[i], dp[nb] + 1);
}
if(!marked[i])maxx = max(maxx, dp[i]);
}
cout << maxx << endl;
}
}
int main()
{
speed();
read();
return 0;
}
/***
5 6 1
1 2
2 4
3 4
1 3
3 5
4 5
5 2 2 3
/*/
컴파일 시 표준 에러 (stderr) 메시지
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
