Submission #44719

# Submission time Handle Problem Language Result Execution time Memory
44719 2018-04-05T12:28:31 Z Pajaraja Senior Postmen (BOI14_postmen) C++17
0 / 100
20 ms 23872 KB
#include <bits/stdc++.h>
using namespace std;
set<int> g[500007];
stack<int> st,sk;
bool vi[500007];
void euler(int s)
{
	while(!g[s].empty())
	{
		int t=*g[s].begin();
		g[s].erase(t);
		g[t].erase(s);
		euler(t);
	}
	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].insert(t2);
		g[t2].insert(t1);
	}
	euler(1);
	while(!st.empty())
	{
		int x=st.top();
		st.pop();
		sk.push(x);
		if(vi[x])
		{
			while(sk.top()!=x)
			{
				int y=sk.top();
				printf("%d ",y);
				sk.pop();
				vi[y]=false;
			}
			printf("\n");
		}
		vi[x]=true;
	}
}

Compilation message

postmen.cpp: In function 'int main()':
postmen.cpp:20:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d%d",&n,&m);
  ~~~~~^~~~~~~~~~~~~~
postmen.cpp:24:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d%d",&t1,&t2);
   ~~~~~^~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 20 ms 23872 KB Some edges were not used
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 19 ms 23808 KB Some edges were not used
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 19 ms 23808 KB Some edges were not used
2 Halted 0 ms 0 KB -