제출 #881597

#제출 시각아이디문제언어결과실행 시간메모리
881597AverageAmogusEnjoyerBitaro’s Party (JOI18_bitaro)C++17
0 / 100
3 ms12380 KiB
#include <bits/stdc++.h> using namespace std; using ll = long long; template<class T> bool cmin(T &i, T j) { return i > j ? i=j,1:0; } template<class T> bool cmax(T &i, T j) { return i < j ? i=j,1:0; } const int B = 90, N = 1e5; multiset<int> dist[N]; map<int,int> start_node[N]; vector<int> adj[N]; int banned[N]; void dfs(int u,int d,int start) { for (int &v: adj[u]) { if (cmax(start_node[u][start],d)) { if (dist[v].size() == B) { if (*dist[v].begin() < d) { dist[v].erase(dist[v].begin()); dist[v].insert(d); dfs(v,d+1,start); } } else { dist[v].insert(d); dfs(v,d+1,start); } } } } void solve() { int n,m,q; cin >> n >> m >> q; for (int u,v;m--;) { cin >> u >> v; adj[--u].push_back(--v); } for (int i=0;i<n;i++) { dist[i].insert(0); } for (int i=0;i<n;i++) { dfs(i,0,i); } for (int u,sz;q--;) { cin >> u >> sz; --u; for (int i=0;i<sz;i++) { cin >> banned[i]; banned[i]--; } } /* for (int i=0;i<n;i++) { for (auto [start,d]: start_node[i]) { cout << d << " " << start << "\n"; } cout << "\n"; } */ } int main() { ios_base::sync_with_stdio(0); cin.tie(0); int _t = 1; for (int i=1;i<=_t;i++) { solve(); } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...