# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
231032 | 2020-05-12T11:57:59 Z | Pajaraja | Senior Postmen (BOI14_postmen) | C++17 | 500 ms | 46504 KB |
#include <bits/stdc++.h> #pragma GCC optimize("O3") using namespace std; vector<long long> g[500007]; int dk[500007]; stack<int> st,sk; bool vi[500007],vig[500007]; inline void euler(int s) { while(dk[s]<g[s].size()) { if(!vig[g[s][dk[s]]>>32LL]) { vig[g[s][dk[s]]>>32LL]=true; euler(g[s][dk[s]++]&((1LL<<32LL)-1)); } else dk[s]++; } st.push(s); } int main() { int n,m; scanf("%d%d",&n,&m); for(int i=0;i<m;i++) { int t1,t2; scanf("%d%d",&t1,&t2); g[t1].push_back(t2+(((long long)i)<<32LL)); g[t2].push_back(t1+(((long long)i)<<32LL)); } euler(1); for(int i=0;i<m+1;i++) { int x=st.top(); st.pop(); if(vi[x]) { while(true) { int y=sk.top(); printf("%d ",y); sk.pop(); vi[y]=false; if(y==x) break; } printf("\n"); } sk.push(x); vi[x]=true; } }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 11 ms | 12160 KB | Output is correct |
2 | Correct | 11 ms | 12032 KB | Output is correct |
3 | Correct | 11 ms | 12160 KB | Output is correct |
4 | Correct | 12 ms | 12288 KB | Output is correct |
5 | Correct | 12 ms | 12160 KB | Output is correct |
6 | Correct | 13 ms | 12288 KB | Output is correct |
7 | Correct | 17 ms | 12928 KB | Output is correct |
8 | Correct | 12 ms | 12160 KB | Output is correct |
9 | Correct | 47 ms | 16376 KB | Output is correct |
10 | Correct | 13 ms | 12160 KB | Output is correct |
11 | Correct | 13 ms | 12160 KB | Output is correct |
12 | Correct | 52 ms | 16760 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 12 ms | 12160 KB | Output is correct |
2 | Correct | 11 ms | 12032 KB | Output is correct |
3 | Correct | 11 ms | 12032 KB | Output is correct |
4 | Correct | 12 ms | 12288 KB | Output is correct |
5 | Correct | 11 ms | 12160 KB | Output is correct |
6 | Correct | 12 ms | 12288 KB | Output is correct |
7 | Correct | 17 ms | 12800 KB | Output is correct |
8 | Correct | 12 ms | 12288 KB | Output is correct |
9 | Correct | 46 ms | 16376 KB | Output is correct |
10 | Correct | 12 ms | 12160 KB | Output is correct |
11 | Correct | 12 ms | 12160 KB | Output is correct |
12 | Correct | 53 ms | 16760 KB | Output is correct |
13 | Correct | 75 ms | 18428 KB | Output is correct |
14 | Correct | 73 ms | 17272 KB | Output is correct |
15 | Correct | 68 ms | 17640 KB | Output is correct |
16 | Correct | 79 ms | 18424 KB | Output is correct |
17 | Correct | 99 ms | 16500 KB | Output is correct |
18 | Correct | 70 ms | 17656 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 11 ms | 12032 KB | Output is correct |
2 | Correct | 11 ms | 12032 KB | Output is correct |
3 | Correct | 11 ms | 12032 KB | Output is correct |
4 | Correct | 12 ms | 12288 KB | Output is correct |
5 | Correct | 11 ms | 12160 KB | Output is correct |
6 | Correct | 13 ms | 12288 KB | Output is correct |
7 | Correct | 18 ms | 12800 KB | Output is correct |
8 | Correct | 12 ms | 12160 KB | Output is correct |
9 | Correct | 47 ms | 16376 KB | Output is correct |
10 | Correct | 12 ms | 12160 KB | Output is correct |
11 | Correct | 13 ms | 12160 KB | Output is correct |
12 | Correct | 51 ms | 16760 KB | Output is correct |
13 | Correct | 72 ms | 18424 KB | Output is correct |
14 | Correct | 72 ms | 17272 KB | Output is correct |
15 | Correct | 67 ms | 17644 KB | Output is correct |
16 | Correct | 74 ms | 18424 KB | Output is correct |
17 | Correct | 78 ms | 16504 KB | Output is correct |
18 | Correct | 72 ms | 17656 KB | Output is correct |
19 | Correct | 472 ms | 44152 KB | Output is correct |
20 | Correct | 446 ms | 38520 KB | Output is correct |
21 | Correct | 414 ms | 39856 KB | Output is correct |
22 | Correct | 475 ms | 44152 KB | Output is correct |
23 | Correct | 198 ms | 32504 KB | Output is correct |
24 | Correct | 500 ms | 34296 KB | Output is correct |
25 | Correct | 479 ms | 46504 KB | Output is correct |