Submission #799306

#TimeUsernameProblemLanguageResultExecution timeMemory
799306elotelo966Naboj (COCI22_naboj)C++17
0 / 110
98 ms21440 KiB
#include <bits/stdc++.h> using namespace std; #define int long long #define OYY 1000000005 #define faster ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL); #define mid (start+end)/2 #define mod 1000000007 vector <int> v[200005]; int re[200005]; vector <pair<int,int>> cev; inline void dfs(int node,int ata,int renk){ for(int i=0;i<v[node].size();i++){ int go=v[node][i]; if(go==ata || re[go]!=-1)continue; re[go]=renk^1; //cout<<node<<" "<<renk<<'\n'; cev.push_back({go,renk^1}); dfs(go,ata,renk^1); } } int32_t main(){ faster int n,m;cin>>n>>m; memset(re,-1,sizeof(re)); for(int i=0;i<m;i++){ int a,b;cin>>a>>b; v[a].push_back(b); v[b].push_back(a); } re[1]=0; cev.push_back({1,0}); dfs(1,-1,0); cout<<cev.size()<<'\n'; for(int i=0;i<cev.size();i++){ cout<<cev[i].first<<" "<<cev[i].second<<'\n'; } return 0; }

Compilation message (stderr)

naboj.cpp: In function 'void dfs(long long int, long long int, long long int)':
naboj.cpp:13:18: 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]
   13 |     for(int i=0;i<v[node].size();i++){
      |                 ~^~~~~~~~~~~~~~~
naboj.cpp: In function 'int32_t main()':
naboj.cpp:36:18: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<std::pair<long long int, long long int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   36 |     for(int i=0;i<cev.size();i++){
      |                 ~^~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...