제출 #726780

#제출 시각아이디문제언어결과실행 시간메모리
726780Tigerpants어르신 집배원 (BOI14_postmen)C++17
0 / 100
0 ms212 KiB
#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) 메시지

postmen.cpp: In function 'int main()':
postmen.cpp:79:26: warning: comparison of integer expressions of different signedness: 'll' {aka 'long long int'} and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   79 |         for (ll j = 0; j < sz(g[i]); j += 2) {
      |                          ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...