結果

問題 No.2888 Mamehinata
ユーザー 矢澤式WINTER矢澤式WINTER
提出日時 2024-09-13 21:38:22
言語 C++23
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,767 bytes
コンパイル時間 5,788 ms
コンパイル使用メモリ 314,928 KB
実行使用メモリ 15,352 KB
最終ジャッジ日時 2024-09-13 21:38:52
合計ジャッジ時間 17,325 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
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 WA -
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 2 ms
5,376 KB
testcase_11 WA -
testcase_12 AC 2 ms
5,376 KB
testcase_13 AC 28 ms
5,376 KB
testcase_14 AC 129 ms
6,656 KB
testcase_15 WA -
testcase_16 AC 309 ms
11,904 KB
testcase_17 WA -
testcase_18 AC 65 ms
6,016 KB
testcase_19 AC 303 ms
11,776 KB
testcase_20 AC 249 ms
10,368 KB
testcase_21 AC 241 ms
10,120 KB
testcase_22 WA -
testcase_23 WA -
testcase_24 AC 328 ms
12,792 KB
testcase_25 AC 315 ms
12,408 KB
testcase_26 AC 314 ms
12,124 KB
testcase_27 AC 280 ms
10,240 KB
testcase_28 AC 50 ms
5,376 KB
testcase_29 AC 126 ms
7,168 KB
testcase_30 AC 320 ms
12,964 KB
testcase_31 AC 275 ms
11,392 KB
testcase_32 AC 195 ms
9,088 KB
testcase_33 AC 245 ms
10,748 KB
testcase_34 AC 208 ms
9,600 KB
testcase_35 AC 179 ms
8,704 KB
testcase_36 AC 372 ms
13,696 KB
testcase_37 AC 380 ms
14,164 KB
testcase_38 AC 104 ms
6,528 KB
testcase_39 AC 324 ms
11,960 KB
testcase_40 AC 392 ms
13,824 KB
testcase_41 AC 61 ms
5,376 KB
testcase_42 AC 331 ms
12,200 KB
testcase_43 AC 263 ms
12,748 KB
testcase_44 AC 285 ms
13,940 KB
testcase_45 AC 335 ms
15,352 KB
testcase_46 AC 43 ms
5,376 KB
testcase_47 AC 279 ms
13,704 KB
testcase_48 AC 192 ms
10,000 KB
testcase_49 AC 11 ms
5,376 KB
testcase_50 AC 30 ms
6,016 KB
testcase_51 AC 3 ms
5,376 KB
testcase_52 AC 2 ms
5,376 KB
testcase_53 AC 6 ms
5,376 KB
testcase_54 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
//*/
#include <atcoder/all>
using namespace atcoder;
// //*/
// #pragma GCC optimize("Ofast,unroll-loops,no-stack-protector,fast-math")
// #pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt")
// #pragma GCC target("avx,avx2,fma")
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,fma")
#define rep(i,n) for(int i=0;i<n;i++)
#define Rep(i,a,b) for(int i=a;i<b;i++)
#define ALL(x) (x).begin(),(x).end()
#define dbgv(x); for(auto now : x) cout << now << " "; cout << endl;
//using P = pair<int,int>;
using ll = long long;
using ull = unsigned long long;
//*/
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<ll> vll;
typedef vector<int> vint;
random_device rnd;
mt19937 rng(rnd());

void solve(){
    int n,m,cnt = 0; cin >> n >> m;
    vector<vint> g(n);
    rep(i,m){
        int u,v; cin >> u >> v;
        u--; v--;
        g[u].push_back(v);
        g[v].push_back(u);
    }
    int w = 0,b = 1;
    vector<bool> vis(n,false);
    vis[0] = true;
    queue<int> now,nxt;
    now.push(0);
    while(1){
        while(!now.empty()){
            int vs = now.front();
            now.pop();
            for(int vf : g[vs])if(!vis[vf]){
                vis[vf] = true;
                w++;
                nxt.push(vf);
            }
        }
        swap(w,b);
        cout << b << endl;
        cnt++;
        swap(now,nxt);
        if(cnt == n) break;
    }
    //dbgv(vis);
}

int main(){
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int t = 1; //cin >> t;
  rep(testcase,t) solve();
}

0