제출 #832549

#제출 시각아이디문제언어결과실행 시간메모리
832549EntityPlantt어르신 집배원 (BOI14_postmen)C++14
0 / 100
14 ms23772 KiB
#include <cstdio> #include <set> using namespace std; set <int> graph[500000], togo; int n, m, a, b, startNode, nowNode; set<int>::iterator nextNode; int main() { scanf("%d%d", &n, &m); while (m--) { scanf("%d%d", &a, &b); graph[--a].insert(--b); graph[b].insert(a); } for (int i = 0; i < n; i++) togo.insert(i); while (!togo.empty()) { startNode = nowNode = *prev(togo.end()); do { printf("%d ", nowNode + 1); nextNode = prev(graph[nowNode].end()); graph[*nextNode].erase(nowNode); graph[nowNode].erase(nextNode); if (graph[nowNode].empty()) togo.erase(nowNode); nowNode = *nextNode; } while (startNode != nowNode); if (graph[startNode].empty()) togo.erase(prev(togo.end())); printf("\n"); } return 0; }

컴파일 시 표준 에러 (stderr) 메시지

postmen.cpp: In function 'int main()':
postmen.cpp:8:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
    8 |     scanf("%d%d", &n, &m);
      |     ~~~~~^~~~~~~~~~~~~~~~
postmen.cpp:10:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   10 |         scanf("%d%d", &a, &b);
      |         ~~~~~^~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...