# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
896053 | pcc | Political Development (BOI17_politicaldevelopment) | C++14 | 3061 ms | 8020 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pll pair<ll,ll>
#define pii pair<int,int>
#define fs first
#define sc second
#define tlll tuple<ll,ll,ll>
const int mxn = 5e4+10;
vector<int> paths[mxn];
int N,K;
inline bool check(vector<int> &tar){
sort(tar.begin(),tar.end());
for(auto &i:tar){
for(auto &j:tar){
if(j == i)continue;
auto it = lower_bound(paths[j].begin(),paths[j].end(),i);
if(it == paths[j].end()||*it != i)return false;
}
}
return true;
}
int main(){
ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
cin>>N>>K;
for(int i = 0;i<N;i++){
int c;
cin>>c;
while(c--){
int tmp;
cin>>tmp;
paths[i].push_back(tmp);
}
sort(paths[i].begin(),paths[i].end());
}
int ans = 0;
for(int i = 0;i<N;i++){
for(int j =0;j<(1<<paths[i].size());j++){
vector<int> tar;
tar.push_back(i);
for(int l = 0;l<paths[i].size();l++){
if(j&(1<<l))tar.push_back(paths[i][l]);
}
if(check(tar))ans = max(ans,__builtin_popcount(j)+1);
}
}
cout<<ans;
}
컴파일 시 표준 에러 (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... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |