| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 146829 | muhammad_hokimiyon | Network (BOI15_net) | C++14 | 9 ms | 5240 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
//#pragma GCC optimize("Ofast")
#define LL long long
#define se second
#define fi first
using namespace std;
const int N = 2e5 + 7;
const int mod = 1e9 + 7;
const int B = sqrt(N);
int n;
bool used[N];
vector < int > v[N];
vector < int > ans;
int main()
{
ios_base::sync_with_stdio(0);
cin.tie(NULL);
//freopen( "input.txt" , "r" , stdin );
//freopen( "output.txt" , "w" , stdout );
cin >> n;
for( int i = 1; i < n; i++ ){
int x,y;
cin >> x >> y;
v[x].push_back(y);
v[y].push_back(x);
}
int x = 1;
for( int i = 1; i <= n; i++ ){
if( v[i].size() == 1 ){
ans.push_back(i);
}
}
int k = ans.size() / 2;
cout << ( (int)ans.size() + 1 ) / 2 << "\n";
for( int i = 0; i < ( ans.size() + 1) / 2; i++ ){
cout << ans[i] << " " << ans[ (i + k) ] << "\n";
}
}
컴파일 시 표준 에러 (stderr) 메시지
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
