제출 #1056588

#제출 시각아이디문제언어결과실행 시간메모리
1056588IgnutClosing Time (IOI23_closing)C++17
8 / 100
76 ms30656 KiB
/* Ignut started: 13.08.2024 now: 13.08.2024 ████████████████████████████████████████████████████████████████████ ████████████████████████████████ ████████████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████ ██████████████████ ██████████████████ ██████ ██████ ██████████████ ██████████████ ██████ ██████ ██ ████████████ ████████████ ██ ██████ ██████ ████ ██████████ ██████████ ████ ██████ ██████ ████ ██████████ ██████████ ████ ██████ ██████ ████ ██████████ ██████████ ██████ ██████ ██████ ██████ ██████████ ██████████ ██████ ██████ ██████ ██████ ████████ ████████ ██████ ██████ ██████ ██████ ██████ ██████ ██████ ██████ ██████ ████ ████ ████ ████ ██████ ██████ ██████████ ████ ██████████ ██████ ██████ ██ ██████ ████████ ██████ ██ ██████ ██████ ██████ ████████ ██████ ██████ ██████ ██ ██ ██████ ██████████████████████ ████ ████ ██████████████████████ ████████████████████████ ██ ██ ████████████████████████ ██████████████████████████ ██████████████████████████ ██████████████████████████████ ██████████████████████████████ ████████████████████████████████████████████████████████████████████ */ #include <bits/stdc++.h> using namespace std; using ll = long long; const int MAXN = 2e5 + 123; vector<pair<int, int>> tree[MAXN]; vector<ll> ds; void dfs(int v, int par, ll d) { ds.push_back(d); for (auto [to, w] : tree[v]) if (to != par) dfs(to, v, d + w); } int max_score(int N, int X, int Y, ll K, vector<int> U, vector<int> V, vector<int> W) { ds.clear(); for (int i = 0; i < N; i ++) tree[i].clear(); for (int i = 0; i < N - 1; i ++) { tree[U[i]].push_back({V[i], W[i]}); tree[V[i]].push_back({U[i], W[i]}); } dfs(X, -1, 0); dfs(Y, -1, 0); sort(ds.begin(), ds.end()); int res = 0; for (int i = 0; i < ds.size(); i ++) { if (ds[i] <= K) { K -= ds[i]; res ++; } } return res; }

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

closing.cpp: In function 'int max_score(int, int, int, ll, std::vector<int>, std::vector<int>, std::vector<int>)':
closing.cpp:58:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   58 |     for (int i = 0; i < ds.size(); 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...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...