結果
問題 | No.583 鉄道同好会 |
ユーザー |
![]() |
提出日時 | 2017-10-27 22:30:11 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 69 ms / 2,000 ms |
コード長 | 1,686 bytes |
コンパイル時間 | 1,617 ms |
コンパイル使用メモリ | 134,688 KB |
最終ジャッジ日時 | 2025-01-05 03:35:06 |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 16 |
コンパイルメッセージ
In file included from /usr/include/x86_64-linux-gnu/c++/13/bits/c++allocator.h:33, from /usr/include/c++/13/bits/allocator.h:46, from /usr/include/c++/13/deque:63, from main.cpp:1: In member function ‘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<_Tp1> >::construct(allocator_type&, _Up*, _Args&& ...) [with _Up = int; _Args = {const int&}; _Tp = int]’ at /usr/include/c++/13/bits/alloc_traits.h:538:17, inlined from ‘void std::deque<_Tp, _Alloc>::push_back(const value_type&) [with _Tp = int; _Alloc = std::allocator<int>]’ at /usr/include/c++/13/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/include/c++/13/bits/stl_queue.h:286:20, inlined from ‘int main()’ at main.cpp:56:10: /usr/include/c++/13/bits/new_allocator.h:191:11: warning: ‘t’ may be used uninitialized [-Wmaybe-uninitialized] 191 | { ::new((void *)__p) _Up(std::forward<_Args>(__args)...); } | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ main.cpp: In function ‘int main()’: main.cpp:49:13: note: ‘t’ was declared here 49 | int t; | ^
ソースコード
#include<deque> #include<queue> #include<vector> #include<algorithm> #include<iostream> #include<set> #include<cmath> #include<tuple> #include<string> #include<chrono> #include<functional> #include<iterator> #include<random> #include<unordered_set> #include<unordered_map> #include<array> #include<map> #include<iomanip> using namespace std; typedef long long int llint; typedef long double lldo; #define mp make_pair #define mt make_tuple #define pub push_back #define puf push_front #define pob pop_back #define pof pop_front #define fir first #define sec second #define res resize #define ins insert #define era erase #define dme cout<<-1<<endl;return 0 //ios::sync_with_stdio(false); //<< setprecision(5) const int mod=1e9+7; const int big=1e8+100; const long double pai=3.141592653589793238462643383279502884197; const long double ena=2.71828182845904523536; const long double eps=1e-7; template <class T,class U>void mineq(T& a,U b){if(a>b){a=b;}} template <class T,class U>void maxeq(T& a,U b){if(a<b){a=b;}} llint gcd(llint a,llint b){if(a%b==0){return b;}else return gcd(b,a%b);} llint lcm(llint a,llint b){return a/gcd(a,b)*b;} int main(void){ int i,j,n,m; cin>>n>>m; vector<vector<int>>go(n); int t; for(i=0;i<m;i++){ int a,b;cin>>a>>b; go[a].pub(b); go[b].pub(a);t=a; } queue<int>que;//連結 que.push(t);//適当 vector<bool>can(n); while(!que.empty()){ int ter=que.front(); que.pop(); if(can[ter]){continue;} can[ter]=true; for(auto it:go[ter]){que.push(it);} } int ki=0; for(i=0;i<n;i++){ if(go[i].size()>0&&(!can[i])){cout<<"NO"<<endl;return 0;} ki+=go[i].size()%2; } if(ki<=2){cout<<"YES"<<endl;} else{cout<<"NO"<<endl;} return 0; }