QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#153777#7052. Xian XiangPetroTarnavskyi#Compile Error//C++171.7kb2023-08-30 22:59:472023-08-30 22:59:48

Judging History

This is the latest submission verdict.

  • [2023-08-30 22:59:48]
  • Judged
  • [2023-08-30 22:59:47]
  • Submitted

answer

#include <bits/stdc++.h>

using namespace std;

#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define RFOR(i, a, b) for (int i = (a) - 1; i >= (b); i--)
#define FILL(a, b) memset(a, b, sizeof(a))
#define SZ(a) int(a.size())
#define ALL(a) a.begin(), a.end()
#define PB push_back
#define MP make_pair

typedef long long LL;
typedef vector<int> VI;
typedef pair<int, int> PII;
typedef double db;

const int N = 1 << 17;
const int M = 1 << 18;

vector<PII> g[N];
int used[N];
PII par[N];
int tin[N], fup[N], timer;
LL depth[N];
vector<PII> cycles[N];
set<pair<int, int>> bridges;
LL dp[N][2];

void dfs(int v, int p)
{
	used[v] = 1;
	tin[v] = fup[v] = timer++;
	for (auto [to, w] : g[v])
	{
		if (to == p)
			continue;
		if (used[to] == 0)
		{
			par[to] = {v, w};
			depth[to] = depth[v] + w;
			dfs(to, v);
			fup[v] = min(fup[v], fup[to]);
			if (fup[to] == tin[to]) 
				bridges.emplace(v, to);
		}
		else if (used[to] == 1)
		{
			cycles[to].emplace_back(v, w);
		}
	}
	vector<LL> vec0, vec1;
	for (auto [to, w] : g[v])
	{
		if (bridges.count(MP(v, to)))
		{
			vec0.push_back(dp[to][0]);
			vec1.push_back(dp[to][1]);
		}
	}
	LL sumCycles = 0;
	for (auto [to, w] : cycles[v])
	{
		LL lenCycle = depth[to] - depth[v] + w;
		sumCycles += lenCycle;
		vector<LL> v0, v1, dist;
		for (int u = to; u != v; u = par[u].first)
		{
			v0.push_back(dp[u][0]);
			v1.push_back(dp[u][1]);
			
			dist.push_back();
		}
	}
	used[v] = 2;
}

int main()
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	int n, m;
	cin >> n >> m;
	FOR(i, 0, m)
	{
		int u, v, w;
		cin >> u >> v >> w;
		u--;
		v--;
		g[u].emplace_back(v, w);
		g[v].emplace_back(u, w);
	}
	dfs1(0, -1);
	FILL(used, 0);
	dfs2(0, -1);
}

Details

answer.code: In function ‘void dfs(int, int)’:
answer.code:72:39: error: no matching function for call to ‘std::vector<long long int>::push_back()’
   72 |                         dist.push_back();
      |                         ~~~~~~~~~~~~~~^~
In file included from /usr/include/c++/11/vector:67,
                 from /usr/include/c++/11/functional:62,
                 from /usr/include/c++/11/pstl/glue_algorithm_defs.h:13,
                 from /usr/include/c++/11/algorithm:74,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:65,
                 from answer.code:1:
/usr/include/c++/11/bits/stl_vector.h:1187:7: note: candidate: ‘void std::vector<_Tp, _Alloc>::push_back(const value_type&) [with _Tp = long long int; _Alloc = std::allocator<long long int>; std::vector<_Tp, _Alloc>::value_type = long long int]’
 1187 |       push_back(const value_type& __x)
      |       ^~~~~~~~~
/usr/include/c++/11/bits/stl_vector.h:1187:7: note:   candidate expects 1 argument, 0 provided
/usr/include/c++/11/bits/stl_vector.h:1203:7: note: candidate: ‘void std::vector<_Tp, _Alloc>::push_back(std::vector<_Tp, _Alloc>::value_type&&) [with _Tp = long long int; _Alloc = std::allocator<long long int>; std::vector<_Tp, _Alloc>::value_type = long long int]’
 1203 |       push_back(value_type&& __x)
      |       ^~~~~~~~~
/usr/include/c++/11/bits/stl_vector.h:1203:7: note:   candidate expects 1 argument, 0 provided
answer.code: In function ‘int main()’:
answer.code:93:9: error: ‘dfs1’ was not declared in this scope; did you mean ‘dfs’?
   93 |         dfs1(0, -1);
      |         ^~~~
      |         dfs
answer.code:95:9: error: ‘dfs2’ was not declared in this scope; did you mean ‘dfs’?
   95 |         dfs2(0, -1);
      |         ^~~~
      |         dfs