제출 #1128401

#제출 시각아이디문제언어결과실행 시간메모리
1128401KasymKPolitical Development (BOI17_politicaldevelopment)C++20
54 / 100
3095 ms25020 KiB
#include "bits/stdc++.h" using namespace std; #define ff first #define ss second #define all(v) v.begin(), v.end() #define ll long long #define pb push_back #define pii pair<int, int> #define pli pair<ll, int> #define pll pair<ll, ll> #define tr(i, c) for(auto i = c.begin(); i != c.end(); ++i) #define wr puts("----------------") template<class T>bool umin(T& a,T b){if(a>b){a=b;return 1;}return 0;} template<class T>bool umax(T& a,T b){if(a<b){a=b;return 1;}return 0;} const int N = 5e3+5; bool adj[N][N]; int answer, n; void dfs(vector<bool> &vis, int mal){ umax(answer, mal); while(1){ bool did=0; for(auto i : vis) did|=i; if(!did) break; int id=n; for(int i = n-1; i >= 0; --i) if(vis[i]){ vis[i]=0; id=i; break; } vector<bool> is(n, false); for(int i = 0; i < n; ++i) if(vis[i] and adj[id][i]) is[i]=1; int cnt=0; for(int i = 0; i < n; ++i) cnt+=is[i]; if(cnt+mal+1>answer) dfs(is, mal+1); } } int main(){ int k; scanf("%d%d", &n, &k); for(int i = 0; i < n; ++i){ int x, ad; scanf("%d", &x); adj[i][i]=1; while(x--) scanf("%d", &ad), adj[i][ad]=1; } vector<bool> vis(n, true); dfs(vis, 0); printf("%d\n", answer); return 0; }

컴파일 시 표준 에러 (stderr) 메시지

politicaldevelopment.cpp: In function 'int main()':
politicaldevelopment.cpp:49:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   49 |     scanf("%d%d", &n, &k);
      |     ~~~~~^~~~~~~~~~~~~~~~
politicaldevelopment.cpp:52:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   52 |         scanf("%d", &x);
      |         ~~~~~^~~~~~~~~~
politicaldevelopment.cpp:55:18: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   55 |             scanf("%d", &ad), adj[i][ad]=1;
      |             ~~~~~^~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...