제출 #107736

#제출 시각아이디문제언어결과실행 시간메모리
107736patrikpavic2어르신 집배원 (BOI14_postmen)C++17
55 / 100
588 ms54720 KiB
#include <cstdio> #include <cstring> #include <cstdlib> #include <ctime> #include <algorithm> #include <stack> #include <set> #include <vector> #include <iostream> #include <queue> #include <map> #define X first #define Y second #define PB push_back #define P push using namespace std; typedef long long ll; typedef long double ld; typedef pair < int, int > pii; typedef vector < int > vi; typedef set < int > si; const int N = 5e5 + 5; const int M = 1e6 + 500; const int INF = 0x3f3f3f3f; const int MOD = 1e9 + 7; const int OFF = (1 << 18); const int LOG = 20; const double EPS = 1e-9; const double PI = 3.1415926535; int bio[N], n, m, nod[N],ind[N]; vector < pii > v[N]; vector < int > st; vi tura; void euler(int x){ for(;ind[x] < v[x].size();ind[x]++){ if(bio[v[x][ind[x]].Y]) continue; bio[v[x][ind[x]].Y] = 1; int nxt = v[x][ind[x]].X; euler(nxt); } tura.PB(x); } void rastavi(){ memset(bio, 0, sizeof(bio)); for(int i = 0;i < tura.size();i++){ if(bio[tura[i]]){ while(st.back() != tura[i]){ printf("%d ", st.back()); bio[st.back()]--; st.pop_back(); } st.pop_back(); bio[tura[i]]--; printf("%d\n", tura[i]); } st.PB(tura[i]); bio[tura[i]]++; } } int main(){ scanf("%d%d", &n, &m); for(int i = 0;i < m;i++){ int x, y; scanf("%d%d", &x, &y); v[x].PB({y, i}); v[y].PB({x, i}); } euler(1); rastavi(); return 0; }

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

postmen.cpp: In function 'void euler(int)':
postmen.cpp:41:17: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for(;ind[x] < v[x].size();ind[x]++){
          ~~~~~~~^~~~~~~~~~~~~
postmen.cpp: In function 'void rastavi()':
postmen.cpp:52:21: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for(int i = 0;i < tura.size();i++){
                   ~~^~~~~~~~~~~~~
postmen.cpp: In function 'int main()':
postmen.cpp:69:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d%d", &n, &m);
     ~~~~~^~~~~~~~~~~~~~~~
postmen.cpp:71:24: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         int x, y; scanf("%d%d", &x, &y);
                   ~~~~~^~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...