Submission #17964

# Submission time Handle Problem Language Result Execution time Memory
17964 2016-01-13T11:47:37 Z chrome Shymbulak (IZhO14_shymbulak) C++
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>

using namespace std;

#define ll long long
#define foreach(it, S) for (__typeof (S.begin()) it = S.begin(); it != S.end(); it++)
#define all(x) x.begin(), x.end()
#define endl '\n'
#define _ ios_base :: sync_with_stdio(false); cin.tie(NULL);

#ifdef inputf
	#define fname ""
#else
	#define fname "" // <- Here
#endif

const double eps = 1e-9;
const int MaxN = int(2e5) + 256;
const int MOD = int(1e9) + 7;

template <typename T> inline T gcd(T a, T b) {
	return b ? gcd (b, a % b) : a;
}

inline bool Palindrome(const string& s) {
	return equal(s.begin(), s.end(), s.rbegin());
}

vector <int> g[MaxN];
int cur, res;
int d[MaxN];
int n;

inline void run(int v) {
	queue <int> q; q.push(v);
	memset(d, 255, sizeof d);

	d[v] = 0;

	while (!q.empty()) {
		int v = q.front(); q.pop();
		for (auto u : g[v]) if (d[u] == -1) {
			d[u] = d[v] + 1; q.push(u);
		}
	}
	int k = *max_element(d + 1, d + 1 + n);
	cerr << v << " " << k << endl;
	for (int i = 1; i <= n; ++i)
		cerr << d[i] << " ";
	cerr << endl;
	if (k > cur) {
		cur = k;
		res = 0;
		for (int i = 1; i <= n; ++i)
			res += (d[i] == cur);
		cerr << "~" << res << endl;
	}
}

int main() { // _
	#ifdef lcl
		freopen(fname".in", "r", stdin);
		freopen(fname".out", "w", stdout);
	#endif

	scanf("%d", &n);

	for (int i = 1; i <= n; ++i) {
		int v, u; scanf("%d%d", &v, &u);
		g[v].push_back(u);
		g[u].push_back(v);
	}

	/* for (int i = 1; i <= n; ++i) {
		run(i);
	} */

	printf("%d", 2);
	
	return 0;
}

Compilation message

shymbulak.cpp: In function ‘void run(int)’:
shymbulak.cpp:42:8: warning: ‘auto’ changes meaning in C++11; please remove it [-Wc++0x-compat]
   for (auto u : g[v]) if (d[u] == -1) {
        ^
shymbulak.cpp:42:13: error: ‘u’ does not name a type
   for (auto u : g[v]) if (d[u] == -1) {
             ^
shymbulak.cpp:45:2: error: expected ‘;’ before ‘}’ token
  }
  ^
shymbulak.cpp:45:2: error: expected primary-expression before ‘}’ token
shymbulak.cpp:45:2: error: expected ‘;’ before ‘}’ token
shymbulak.cpp:45:2: error: expected primary-expression before ‘}’ token
shymbulak.cpp:45:2: error: expected ‘)’ before ‘}’ token
shymbulak.cpp:45:2: error: expected primary-expression before ‘}’ token
shymbulak.cpp:41:7: warning: unused variable ‘v’ [-Wunused-variable]
   int v = q.front(); q.pop();
       ^
shymbulak.cpp: In function ‘int main()’:
shymbulak.cpp:66:17: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d", &n);
                 ^
shymbulak.cpp:69:34: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
   int v, u; scanf("%d%d", &v, &u);
                                  ^