# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
107733 | 2019-04-25T15:04:04 Z | patrikpavic2 | 어르신 집배원 (BOI14_postmen) | C++17 | 8 ms | 2560 KB |
#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 = 1500; 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]; stack < pii > v[N]; stack < int > st; vi tura; void euler(int x){ for(;!v[x].empty();){ if(bio[v[x].top().Y]){ v[x].pop();continue; } bio[v[x].top().Y] = 1; int nxt = v[x].top().X; v[x].pop(); euler(nxt); } tura.PB(x); } void rastavi(){ memset(bio, 0, sizeof(bio)); for(int i = 0;i < tura.size();i++){ if(bio[tura[i]]){ if(st.empty()){ printf("PUSI KURAC EULER\n"); return; } while(st.top() != tura[i]){ printf("%d ", st.top()); bio[st.top()]--; st.pop(); if(st.empty()){ printf("PUSI KURAC EULER\n"); return; } } st.pop(); bio[tura[i]]--; printf("%d\n", tura[i]); } st.P(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].P({y, i}); v[y].P({x, i}); } euler(1); rastavi(); return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 6 ms | 1280 KB | Output is correct |
2 | Correct | 6 ms | 1408 KB | Output is correct |
3 | Correct | 6 ms | 1280 KB | Output is correct |
4 | Runtime error | 6 ms | 2432 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
5 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 1408 KB | Output is correct |
2 | Correct | 5 ms | 1280 KB | Output is correct |
3 | Correct | 5 ms | 1280 KB | Output is correct |
4 | Runtime error | 8 ms | 2432 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
5 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 6 ms | 1280 KB | Output is correct |
2 | Correct | 5 ms | 1280 KB | Output is correct |
3 | Correct | 6 ms | 1280 KB | Output is correct |
4 | Runtime error | 8 ms | 2560 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
5 | Halted | 0 ms | 0 KB | - |