제출 #960042

#제출 시각아이디문제언어결과실행 시간메모리
960042ramalzaherNetwork (BOI15_net)C++14
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> #include<ext/pb_ds/assoc_container.hpp> using namespace std; //typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update > ordered_set ; #define int long long #define F first #define S second #define rep(i , j , n ) for(int i = j ;i < n; i++ ) #define FOR(i , n ) rep(i ,0 , n ) #define sz size() #define pb push_back #define all(x) x.begin() , x.end() #define vi vector<int> #define yes cout<<"YES\n"; #define no cout<<"NO\n"; #define cans cout<<ans<<endl; #define forx(i, x) for(auto &i : x) #define fast #define pii pair<int ,int > #define endl "\n" #define sp ' ' #define test int t ; cin >> t ; while(t--) const int N = 300 ; const int inf = 1e15 ; int n ; main() { cin >> n ; vi v[n+22] ; FOR(i ,n-1 ) { int a , b; cin >> a >> b; v[a].pb(b) ; v[b].pb(a) ; } vi leaves ; rep(i , 1 , n + 1 ) { if(v[i].sz == 1 ) { leaves.pb(i) ; } } int ans = leaves.sz+1 ; ans/=2 ; cout<<ans<<endl; int sz1 = leaves.sz ; // leaves.pb(); if(sz1&1){while(1)} FOR(i , sz1 ) { cout<<leaves[i]<<" " << leaves[i+1] << endl; i ++ ; } // if(sz1&1)cout<<leaves[sz1-1] << " " << leaves[0]<<endl; return 0 ; }

컴파일 시 표준 에러 (stderr) 메시지

net.cpp:28:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   28 | main()
      | ^~~~
net.cpp: In function 'int main()':
net.cpp:48:23: error: expected primary-expression before '}' token
   48 |     if(sz1&1){while(1)}
      |                       ^