Submission #1116087

#TimeUsernameProblemLanguageResultExecution timeMemory
1116087vjudge1Political Development (BOI17_politicaldevelopment)C++17
100 / 100
664 ms319048 KiB
#include <bits/stdc++.h> #define ll long long #define ld long double #define el cout << '\n' #define f1(i,n) for(int i=1;i<=n;i++) #define __file_name "" using namespace std; const ll maxn = 1e6+5, inf=1e18; int n, k, ans; bitset<50000> bit[50000], xx; queue<vector<int>> qu; vector<int> cur; int main(){ ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0); if(fopen(__file_name ".inp", "r")){ freopen(__file_name ".inp","r",stdin); freopen(__file_name ".out","w",stdout); } // code here cin >> n >> k; for(int i=0;i<n;i++){ int d, v; cin >> d; f1(_, d) { cin >> v; if(i < v) bit[i][v] = 1; } } for(int i=0;i<n;i++) qu.push({i}); while(!qu.empty()){ ans = max(ans, (int)qu.front().size()); cur = qu.front(); qu.pop(); xx = bit[cur.back()]; for(int item: cur){ xx &= bit[item]; } int ii = xx._Find_first(); while(ii < 50000){ cur.push_back(ii); qu.push(cur); cur.pop_back(); ii = xx._Find_next(ii); } } cout << ans; return 0; }

Compilation message (stderr)

politicaldevelopment.cpp: In function 'int main()':
politicaldevelopment.cpp:19:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   19 |         freopen(__file_name ".inp","r",stdin);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
politicaldevelopment.cpp:20:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   20 |         freopen(__file_name ".out","w",stdout);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#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...