# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
83095 | osmanorhan | Bosses (BOI16_bosses) | C++17 | 238 ms | 263168 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <string>
#include <cmath>
#include <climits>
#include <algorithm>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <cassert>
#include <vector>
#define all(x) x.begin() , x.end()
#define fi first
#define se second
#define pb push_back
#define umax( x , y ) x = max( x , (y) )
#define umin( x , y ) x = min( x , (y) )
#define null NULL
#define ort (b+s)/2
using namespace std;
typedef long long Lint;
typedef long double db;
typedef pair<int,int> ii;
typedef pair<int,ii> iii;
typedef pair<db,db> dd;
typedef pair<int,string> is;
const int maxn = 10520;
const int maxx = 10500;
const int MOd = 998244353;
int a;
int dad[maxn];
long long cur;
int used[maxn];
vector<int> w[maxn];
int dfs( int n ) {
for(int i=0;i<w[n].size();i++)
if( !dad[ w[n][i] ] ) dad[ w[n][i] ] = n;
int ret = 1;
for(int i=0;i<w[n].size();i++)
if( dad[ w[n][i] ] == n ) ret += dfs( w[n][i] );
cur += ret;
return ret;
}
int main( ) {
scanf("%d",&a);
for(int i=1,k;i<=a;i++) {
scanf("%d",&k);
for(int j=0,t;j<k;j++) {
scanf("%d",&t);
w[t].pb( i );
}
}
long long int ans = 0;
for(int i=1;i<=a;i++) {
memset( dad, 0, sizeof( dad ) );
memset( used, 0, sizeof( used ) );
cur = 0;dfs( i );
umax( ans, cur );
}
cout << ans << endl;
return 0;
}
컴파일 시 표준 에러 (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... |