Submission #1115846

#TimeUsernameProblemLanguageResultExecution timeMemory
1115846ThanhsPolitical Development (BOI17_politicaldevelopment)C++17
0 / 100
44 ms1112 KiB
#include <bits/stdc++.h> using namespace std; #define name "TENBAI" #define fi first #define se second #define int long long #define endl '\n' #define setmin(x, y) x = min((x), (y)) #define setmax(x, y) x = max((x), (y)) #define sqr(x) ((x) * (x)) mt19937 hdp(chrono::high_resolution_clock::now().time_since_epoch().count()); int rand(int l, int r){return l + ((hdp() % (r - l + 1)) + r - l + 1) % (r - l + 1);} const int NM = 5e4 + 5; int ans = 1, n, k; bitset<NM> g; void solve() { cin >> n >> k; vector<vector<int>> v; for (int i = 0; i < n; i++) { g.reset(); int t; cin >> t; while (t--) { int x; cin >> x; g[x] = 1; } for (auto& t : v) { bool sus = 0; for (int x : t) if (!g[x]) sus = 1; if (!sus) { v.push_back(t); v.back().push_back(i); setmax(ans, (int)v.back().size()); } } v.push_back(vector<int>(1, i)); } cout << ans; } signed main() { if (fopen("in.txt", "r")) { freopen("in.txt", "r", stdin); freopen("out.txt", "w", stdout); } else if (fopen(name".inp", "r")) { freopen(name".inp", "r", stdin); freopen(name".out", "w", stdout); } ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); int tc = 1; // cin >> tc; while (tc--) solve(); }

Compilation message (stderr)

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