結果
問題 | No.2427 Tree Distance Two |
ユーザー |
![]() |
提出日時 | 2023-08-18 23:21:31 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 90 ms / 2,000 ms |
コード長 | 459 bytes |
コンパイル時間 | 876 ms |
コンパイル使用メモリ | 91,356 KB |
実行使用メモリ | 7,936 KB |
最終ジャッジ日時 | 2024-11-28 10:23:39 |
合計ジャッジ時間 | 5,042 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 35 |
ソースコード
#include <iostream>#include <utility>#include <vector>using namespace std;int main() {cin.tie(nullptr)->sync_with_stdio(false);int N;cin >> N;vector<pair<int, int>> edges(N - 1);vector<int> deg(N);for (auto &[a, b] : edges) cin >> a >> b, --a, --b, deg.at(a)++, deg.at(b)++;auto deg2 = deg;for (auto [a, b] : edges) deg2.at(a) -= deg.at(b), deg2.at(b) -= deg.at(a);for (auto d : deg2) cout << -d << '\n';}