Submission #912873

# Submission time Handle Problem Language Result Execution time Memory
912873 2024-01-20T03:46:13 Z 1075508020060209tc Senior Postmen (BOI14_postmen) C++14
0 / 100
6 ms 16732 KB
#pragma GCC optimize("O3")
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define X first
#define Y second
#define SZ(x) (int)(x).size()

int n;int m;
int ar[500005];
int br[500005];
vector<int>e[500005];
int eit[500005];
int vis[500005];
vector<int>ans;
void dfs(int nw){
for(;eit[nw]<e[nw].size();eit[nw]++){
    int id=e[nw][eit[nw]];
    if(vis[id]){continue;}
    vis[id]=1;
    int v=ar[id]^br[id]^nw;
    dfs(v);
}
ans.push_back(nw);
}


signed main(){

cin>>n>>m;
for(int i=1;i<=m;i++){
    cin>>ar[i]>>br[i];
    e[ar[i]].push_back(i);
    e[br[i]].push_back(i);
}
dfs(1);
for(int i=0;i<ans.size()-1;i++){
    cout<<ans[i]<<" ";
}cout<<"\n";

}




Compilation message

postmen.cpp: In function 'void dfs(long long int)':
postmen.cpp:17:13: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   17 | for(;eit[nw]<e[nw].size();eit[nw]++){
      |      ~~~~~~~^~~~~~~~~~~~~
postmen.cpp: In function 'int main()':
postmen.cpp:37:14: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   37 | for(int i=0;i<ans.size()-1;i++){
      |             ~^~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 6 ms 16728 KB Output is correct
2 Incorrect 5 ms 16728 KB Same junction appears twice in a route
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 5 ms 16732 KB Output is correct
2 Incorrect 5 ms 16732 KB Same junction appears twice in a route
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 4 ms 16728 KB Output is correct
2 Incorrect 5 ms 16732 KB Same junction appears twice in a route
3 Halted 0 ms 0 KB -