結果
問題 | No.2301 Namorientation |
ユーザー | umezo |
提出日時 | 2023-05-12 23:07:50 |
言語 | C++17 (gcc 12.3.0 + boost 1.83.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 902 bytes |
コンパイル時間 | 2,011 ms |
コンパイル使用メモリ | 207,848 KB |
実行使用メモリ | 19,600 KB |
最終ジャッジ日時 | 2023-08-19 06:01:41 |
合計ジャッジ時間 | 16,668 ms |
ジャッジサーバーID (参考情報) |
judge11 / judge12 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 4 ms
8,112 KB |
testcase_01 | AC | 4 ms
8,068 KB |
testcase_02 | AC | 4 ms
8,024 KB |
testcase_03 | WA | - |
testcase_04 | AC | 4 ms
8,020 KB |
testcase_05 | WA | - |
testcase_06 | WA | - |
testcase_07 | WA | - |
testcase_08 | AC | 3 ms
8,052 KB |
testcase_09 | AC | 4 ms
8,320 KB |
testcase_10 | WA | - |
testcase_11 | AC | 4 ms
8,176 KB |
testcase_12 | WA | - |
testcase_13 | WA | - |
testcase_14 | WA | - |
testcase_15 | WA | - |
testcase_16 | WA | - |
testcase_17 | WA | - |
testcase_18 | WA | - |
testcase_19 | WA | - |
testcase_20 | WA | - |
testcase_21 | WA | - |
testcase_22 | AC | 298 ms
18,584 KB |
testcase_23 | AC | 283 ms
18,456 KB |
testcase_24 | AC | 247 ms
16,968 KB |
testcase_25 | WA | - |
testcase_26 | WA | - |
testcase_27 | WA | - |
testcase_28 | WA | - |
testcase_29 | WA | - |
testcase_30 | WA | - |
testcase_31 | WA | - |
ソースコード
#define rep(i,n) for(int i=0;i<(int)(n);i++) #define ALL(v) v.begin(),v.end() typedef long long ll; #include<bits/stdc++.h> using namespace std; vector<int> G[200200]; int main(){ ios::sync_with_stdio(false); std::cin.tie(nullptr); int n; cin>>n; vector<int> A(n),B(n),deg(n); rep(i,n){ cin>>A[i]>>B[i]; A[i]--,B[i]--; G[A[i]].push_back(B[i]); G[B[i]].push_back(A[i]); deg[A[i]]++; deg[B[i]]++; } priority_queue<pair<int,int>, vector<pair<int,int>>, greater<pair<int,int>>> que; rep(i,n) que.push({G[i].size(),i}); vector<int> to(n,-1); while(que.size()){ auto [a,b]=que.top(); que.pop(); if(to[b]!=-1) continue; for(auto nv:G[b]){ if(to[nv]==b) continue; to[b]=nv; deg[b]--; deg[nv]--; break; } } rep(i,n){ if(to[A[i]]==B[i]) cout<<"->"<<endl; else cout<<"<-"<<endl; } return 0; }