| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 726780 | Tigerpants | Senior Postmen (BOI14_postmen) | C++17 | 0 ms | 212 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
#include <numeric>
#include <set>
#include <map>
#include <numeric>
#include <random>
using namespace std;
typedef long long int ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef set<ll> sll;
typedef vector<sll> vsll;
typedef vector<bool> vb;
typedef pair<ll, ll> pll;
typedef vector<pll> vpll;
typedef vector<vpll> vvpll;
#define rep(i, a, b) for (ll i = a; i < b; i++)
#define mp(a, b) make_pair(a, b)
#define sz(a) a.size()
#define pb(a) push_back(a)
ll N, M;
vvll g;
vpll e;
vvpll ge; // (edge #, node)
vb vis;
vb vis_nodes;
bool flag;
void DFS(ll cur) {
vis[cur] = true;
vll nodes;
for (vpll::iterator itr = ge[cur].begin(); itr != ge[cur].end(); itr++) {
if (vis[itr->second]) continue;
if (!flag) {
cout << e[cur].first + e[cur].second - itr->first + 1 << " ";
nodes.pb(e[cur].first + e[cur].second - itr->first);
vis_nodes[nodes.back()] = true;
}
flag = true;
if (vis_nodes[itr->first]) cout << "\n";
cout << itr->first + 1 << " ";
nodes.pb(itr->first);
vis_nodes[nodes.back()] = true;
DFS(itr->second);
}
for (vll::iterator itr = nodes.begin(); itr != nodes.end(); itr++) {
vis_nodes[*itr] = false;
}
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cin >> N >> M;
g.resize(N);
e.resize(M);
rep(i, 0, M) {
ll tmpa, tmpb;
cin >> tmpa >> tmpb;
tmpa--; tmpb--;
g[tmpa].pb(i);
g[tmpb].pb(i);
e[i] = mp(tmpa, tmpb);
}
ge.resize(M);
rep(i, 0, N) {
for (ll j = 0; j < sz(g[i]); j += 2) {
ge[g[i][j]].pb(mp(i, g[i][j + 1]));
ge[g[i][j + 1]].pb(mp(i, g[i][j]));
}
}
vis.resize(M, false);
vis_nodes.resize(N, false);
rep(i, 0, M) {
flag = false;
DFS(i);
if (flag) cout << "\n";
}
cout << flush;
return 0;
}컴파일 시 표준 에러 (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... | ||||
