結果
問題 | No.1424 Ultrapalindrome |
ユーザー | GRMN |
提出日時 | 2021-05-02 21:40:32 |
言語 | C++17 (gcc 13.2.0 + boost 1.83.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,672 bytes |
コンパイル時間 | 6,129 ms |
コンパイル使用メモリ | 267,044 KB |
実行使用メモリ | 10,224 KB |
最終ジャッジ日時 | 2023-09-28 12:22:17 |
合計ジャッジ時間 | 7,098 ms |
ジャッジサーバーID (参考情報) |
judge15 / judge11 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 1 ms
4,380 KB |
testcase_01 | AC | 2 ms
4,376 KB |
testcase_02 | AC | 2 ms
4,376 KB |
testcase_03 | AC | 2 ms
4,376 KB |
testcase_04 | AC | 1 ms
4,376 KB |
testcase_05 | AC | 1 ms
4,376 KB |
testcase_06 | AC | 2 ms
4,376 KB |
testcase_07 | AC | 1 ms
4,380 KB |
testcase_08 | WA | - |
testcase_09 | AC | 72 ms
8,016 KB |
testcase_10 | AC | 71 ms
8,160 KB |
testcase_11 | AC | 50 ms
6,624 KB |
testcase_12 | AC | 68 ms
7,900 KB |
testcase_13 | AC | 17 ms
4,412 KB |
testcase_14 | AC | 55 ms
7,024 KB |
testcase_15 | AC | 1 ms
4,376 KB |
testcase_16 | AC | 40 ms
6,000 KB |
testcase_17 | AC | 51 ms
6,724 KB |
testcase_18 | AC | 33 ms
5,688 KB |
testcase_19 | AC | 48 ms
6,696 KB |
testcase_20 | AC | 12 ms
4,380 KB |
testcase_21 | AC | 40 ms
5,900 KB |
testcase_22 | AC | 24 ms
4,996 KB |
testcase_23 | AC | 5 ms
4,380 KB |
testcase_24 | AC | 11 ms
4,380 KB |
testcase_25 | AC | 10 ms
4,376 KB |
testcase_26 | AC | 62 ms
7,256 KB |
testcase_27 | WA | - |
testcase_28 | AC | 65 ms
8,640 KB |
testcase_29 | AC | 68 ms
9,444 KB |
testcase_30 | AC | 54 ms
10,224 KB |
testcase_31 | AC | 67 ms
10,144 KB |
コンパイルメッセージ
次のファイルから読み込み: /usr/local/gcc7/include/c++/12.2.0/x86_64-pc-linux-gnu/bits/c++allocator.h:33, 次から読み込み: /usr/local/gcc7/include/c++/12.2.0/bits/allocator.h:46, 次から読み込み: /usr/local/gcc7/include/c++/12.2.0/string:41, 次から読み込み: /usr/local/gcc7/include/c++/12.2.0/bits/locale_classes.h:40, 次から読み込み: /usr/local/gcc7/include/c++/12.2.0/bits/ios_base.h:41, 次から読み込み: /usr/local/gcc7/include/c++/12.2.0/ios:42, 次から読み込み: /usr/local/gcc7/include/c++/12.2.0/istream:38, 次から読み込み: /usr/local/gcc7/include/c++/12.2.0/sstream:38, 次から読み込み: /usr/local/gcc7/include/c++/12.2.0/complex:45, 次から読み込み: /usr/local/gcc7/include/c++/12.2.0/ccomplex:39, 次から読み込み: /usr/local/gcc7/include/c++/12.2.0/x86_64-pc-linux-gnu/bits/stdc++.h:54, 次から読み込み: main.cpp:1: メンバ関数 ‘void std::__new_allocator<_Tp>::construct(_Up*, _Args&& ...) [with _Up = int; _Args = {const int&}; _Tp = int]’ 内, inlined from ‘static void std::allocator_traits<std::allocator<_CharT> >::construct(allocator_type&, _Up*, _Args&& ...) [with _Up = int; _Args = {const int&}; _Tp = int]’ at /usr/local/gcc7/include/c++/12.2.0/bits/alloc_traits.h:516:17, inlined from ‘void std::deque<_Tp, _Alloc>::push_back(const value_type&) [with _Tp = int; _Alloc = std::allocator<int>]’ at /usr/local/gcc7/include/c++/12.2.0/bits/stl_deque.h:1543:30, inlined from ‘void std::queue<_Tp, _Sequence>::push(const value_type&) [with _Tp = int; _Sequence = std::deque<int, std::allocator<int> >]’ at /usr/local/gcc7/include/c++/12.2.0/bits/stl_queue.h:286:20, inlined from ‘int main()’ at main.cpp:50:13: /usr/local/gcc7/include/c++/12.2.0/bits/new_allocator.h:175:11: 警告: ‘id’ may be used uninitialized [-Wmaybe-uninitialized] 175 |
ソースコード
#include <bits/stdc++.h> using namespace std; #include <atcoder/all> using namespace atcoder; #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(v) begin(v),end(v) #define rall(v) rbegin(v),rend(v) #define fi first #define se second #define re0 return 0 template<typename A, typename B> inline bool chmax(A &a, B b) { if (a<b) { a=b; return 1; } return 0; } template<typename A, typename B> inline bool chmin(A &a, B b) { if (a>b) { a=b; return 1; } return 0; } using ll = long long; using pii = pair<int, int>; using pll = pair<ll, ll>; constexpr ll inf = 2e9; constexpr ll llinf = 9e18; //constexpr ll MOD = 998244353; constexpr ll MOD = 1000000007; const double pai=acos(-1); int main() { //cout<<fixed<<setprecision(15); int n;cin>>n; vector<vector<int>> g(n); rep(i,n-1){ int a,b;cin>>a>>b; a--;b--; g[a].push_back(b); g[b].push_back(a); } int tmp=0,id; rep(i,n){ int a=g[i].size(); if(a>tmp){ tmp=a; id=i; } } if(tmp==1||tmp==2){ cout<<"Yes"<<endl; re0; } //cout<<id<<endl; vector<int> vec(n); vector<int> d(n,-1); queue<int> que; d[id]=0; que.push(id); while(!que.empty()){ int v=que.front();que.pop(); for(auto u:g[v]){ if(d[u]!=-1)continue; d[u]=d[v]+1; que.push(u); if(g[u].size()==1)vec[u]=1; } } //rep(i,n)cout<<d[i]<<endl; set<int> st; rep(i,n){ if(vec[i])st.insert(d[i]); } if(st.size()==1)cout<<"Yes"<<endl; else cout<<"No"<<endl; }