제출 #1095386

#제출 시각아이디문제언어결과실행 시간메모리
1095386quanlt206Railway (BOI17_railway)C++17
0 / 100
17 ms7608 KiB
#include<bits/stdc++.h> #define X first #define Y second #define all(x) begin(x), end(x) #define FOR(i, a, b) for(int i = (a); i <= (b); i++) #define FORD(i, b, a) for(int i = (b); i >= (a); i--) #define REP(i, a, b) for (int i = (a); i < (b); i++) #define mxx max_element #define mnn min_element #define SQR(x) (1LL * (x) * (x)) #define MASK(i) (1LL << (i)) #define Point Vector #define left Left #define right Right #define div Div using namespace std; typedef long long ll; typedef unsigned long long ull; typedef double db; typedef long double ld; typedef pair<db, db> pdb; typedef pair<ld, ld> pld; typedef pair<int, int> pii; typedef pair<int, pii> piii; typedef pair<ll, ll> pll; typedef pair<ll, pll> plll; typedef pair<ll, int> pli; typedef pair<ll, pii> plii; template<class A, class B> bool maximize(A& x, B y) { if (x < y) return x = y, true; else return false; } template<class A, class B> bool minimize(A& x, B y) { if (x > y) return x = y, true; else return false; } /* END OF TEMPLATE */ const int N = 1e5 + 7; int n, m, k; vector<pii> v[N]; namespace sub12 { bitset<2007> bit[10007]; pii P[N]; void dfs(int x, int par) { for (auto y : v[x]) if (y.X != par) { P[y.X] = {x, y.Y}; dfs(y.X, x); } } void update(int x, int y, int w) { dfs(x, x); while (y != x) { bit[P[y].Y].set(w, 1); y = P[y].X; } } void Process() { for (int t = 1; t <= m; t++) { int s; cin>>s; vector<int> a(s, 0); for (auto &x : a) cin>>x; for (int i = 1; i < a.size(); i++) update(a[i - 1], a[i], t); } vector<int> res; for (int i = 1; i < n - 1; i++) if (bit[i].count() >= k) res.push_back(i); cout<<res.size()<<"\n"; for (auto x : res) cout<<x<<" "; } } int main() { ios_base::sync_with_stdio(0); cin.tie(0); cin>>n>>m>>k; for (int i = 1; i < n; i++) { int x, y; cin>>x>>y; v[x].push_back({y, i}); v[y].push_back({x, i}); } if (n <= 10000) { sub12::Process(); return 0; } return 0; }

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

railway.cpp: In function 'void sub12::Process()':
railway.cpp:72:31: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   72 |             for (int i = 1; i < a.size(); i++) update(a[i - 1], a[i], t);
      |                             ~~^~~~~~~~~~
railway.cpp:76:32: warning: comparison of integer expressions of different signedness: 'std::size_t' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   76 |             if (bit[i].count() >= k) res.push_back(i);
      |                 ~~~~~~~~~~~~~~~^~~~
#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...
#Verdict Execution timeMemoryGrader output
Fetching results...