結果

問題 No.2888 Mamehinata
ユーザー cho435cho435
提出日時 2024-09-14 20:51:42
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 142 ms / 2,000 ms
コード長 1,005 bytes
コンパイル時間 4,832 ms
コンパイル使用メモリ 264,944 KB
実行使用メモリ 17,396 KB
最終ジャッジ日時 2024-09-14 20:51:53
合計ジャッジ時間 10,914 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 2 ms
5,248 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 2 ms
5,376 KB
testcase_04 AC 3 ms
5,376 KB
testcase_05 AC 2 ms
5,376 KB
testcase_06 AC 2 ms
5,376 KB
testcase_07 AC 2 ms
5,376 KB
testcase_08 AC 2 ms
5,376 KB
testcase_09 AC 2 ms
5,376 KB
testcase_10 AC 3 ms
5,376 KB
testcase_11 AC 2 ms
5,376 KB
testcase_12 AC 2 ms
5,376 KB
testcase_13 AC 23 ms
5,504 KB
testcase_14 AC 21 ms
7,296 KB
testcase_15 AC 82 ms
10,496 KB
testcase_16 AC 135 ms
13,312 KB
testcase_17 AC 23 ms
8,576 KB
testcase_18 AC 44 ms
6,784 KB
testcase_19 AC 117 ms
13,184 KB
testcase_20 AC 88 ms
11,648 KB
testcase_21 AC 100 ms
11,392 KB
testcase_22 AC 41 ms
10,624 KB
testcase_23 AC 59 ms
12,928 KB
testcase_24 AC 101 ms
14,464 KB
testcase_25 AC 82 ms
13,824 KB
testcase_26 AC 77 ms
13,696 KB
testcase_27 AC 41 ms
11,648 KB
testcase_28 AC 15 ms
5,376 KB
testcase_29 AC 40 ms
7,680 KB
testcase_30 AC 122 ms
14,208 KB
testcase_31 AC 96 ms
12,416 KB
testcase_32 AC 59 ms
9,728 KB
testcase_33 AC 89 ms
11,776 KB
testcase_34 AC 66 ms
10,496 KB
testcase_35 AC 57 ms
9,472 KB
testcase_36 AC 135 ms
15,232 KB
testcase_37 AC 139 ms
15,616 KB
testcase_38 AC 30 ms
6,656 KB
testcase_39 AC 116 ms
13,056 KB
testcase_40 AC 142 ms
15,360 KB
testcase_41 AC 18 ms
5,376 KB
testcase_42 AC 107 ms
13,568 KB
testcase_43 AC 76 ms
14,540 KB
testcase_44 AC 92 ms
15,860 KB
testcase_45 AC 100 ms
17,396 KB
testcase_46 AC 12 ms
5,376 KB
testcase_47 AC 86 ms
15,628 KB
testcase_48 AC 73 ms
10,968 KB
testcase_49 AC 11 ms
5,376 KB
testcase_50 AC 33 ms
7,040 KB
testcase_51 AC 3 ms
5,376 KB
testcase_52 AC 3 ms
5,376 KB
testcase_53 AC 7 ms
5,376 KB
testcase_54 AC 2 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <atcoder/all>
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, s, t) for (ll i = s; i < (ll)(t); i++)

template<typename T>
bool chmin(T &x, T y) { return x > y ? (x = y, true) : false; }
template<typename T>
bool chmax(T &x, T y) { return x < y ? (x = y, true) : false; }

struct io_setup {
	io_setup() {
		ios::sync_with_stdio(false);
		std::cin.tie(nullptr);
		cout << fixed << setprecision(15);
	}
} io_setup;

int main(){
	int n,m;
	cin>>n>>m;
	vector<vector<int>> g(n);
	rep(i,0,m){
		int a,b;
		cin>>a>>b;
		a--; b--;
		g.at(a).push_back(b);
		g.at(b).push_back(a);
	}
	vector<int> sm(n+1,0);
	queue<pair<int,int>> q;
	q.push({0,0});
	vector<int> stl(n,0);
	while(!q.empty()){
		auto[nw,h]=q.front();
		q.pop();
		if(stl.at(nw)) continue;
		stl.at(nw)=1;
		sm.at(h)++;
		for(int nx:g.at(nw)){
			if(stl.at(nx)) continue;
			q.push({nx,h+1});
		}
	}
	int nw1=0,nw2=(sm.at(1)>0?1:0);
	rep(i,1,n+1){
		nw1+=sm.at(i);
		cout<<nw1<<"\n";
		swap(nw1,nw2);
	}
}
0