QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#359587#408. Dungeon 2abc123Compile Error//C++202.2kb2024-03-20 19:17:512024-03-20 19:17:52

Judging History

你现在查看的是最新测评结果

  • [2024-03-20 19:17:52]
  • 评测
  • [2024-03-20 19:17:51]
  • 提交

answer

#include <bits/stdc++.h>
#include dungeon.h
using namespace std;
#define pii pair<int,int>

vector<int> do_wym[203];
vector<pii> graph[203];
vector<pii> sciezki[203][203];
int matrix[203][203];
int dp[203][203];
int wyn[203];
pii fat[203];
int deg[203];
int wolne=0;

void dfs(int v, int p){
	if (v!=1){
		fat[v]={LastRoad(),p};
		do_wym[v][LastRoad()]=p;
	}
	deg[v]=NumberOfRoads();
	do_wym[v].resize(deg[v]+1);
	for (int i = 1; i<=deg[v]; i++){
		Move(i,2);
		if (Color()==2)Move(LastRoad(),2);
		else{
			do_wym[v][i]=++wolne;
			graph[v].push_back({wolne,i});
			dfs(wolne,v);
		}
	}
	if (v!=1)Move(fat[v].first,2);
}

bool build_sciezka(int v, int p, int a, int b){
	if (v==b)return true;
	for (auto u : graph[v]){
		if (v==p)continue;
		sciezki[a][b].push_back(u);
		if (build_sciezka(u.first,v,a,b))return true;
		sciezki[a][b].pop_back();
	}
	return false;
}

void MyMove(int a, int b){
	if (a==b)return;
	Move(sciezki[a][b][0].second,Color());
	for (int i = 1; i<sciezki[a][b].size(); i++){
		Move(sciezki[a][b][i].second,Color());
	}
}

void Inspect(int R){
	dfs(++wolne,0);
	int n=wolne;
	for (int i = 1; i<=n; i++){
		for (int j = 1; j<=n; j++){
			build_sciezka(i,0,i,j);
		}
	}
	int cur=1;
	for (int i = 1; i<=n; i++){
		MyMove(cur,i);
		cur=i;
		Move(1,3);
		Move(LastRoad(),1);
		for (int j = i+1; j<=n; j++){
			MyMove(cur,j);
			cur=j;
			for (int u = 1; u<=deg[cur]; u++){
				if (do_wym[cur][u])continue;
				Move(u,1);
				if (Color()==3){
					matrix[i][j]=matrix[j][i]=1;
					Move(LastRoad(),3);
				}
				else Move(LastRoad(),1);
			}
		}
		MyMove(cur,i);
		Move(1,1);
		Move(LastRoad(),1);
	}
	for (int i = 1; i<=n; i++){
		for (auto u : graph[i])matrix[i][u.first]=matrix[u.first][i]=1;
	}
	for (int i = 1; i<=n; i++){
		for (int j = 1; j<=n; j++){
			dp[i][j]=n+2;
			if (i==j)dp[i][j]=0;
			if (matrix[i][j])dp[i][j]=matrix[i][j];
		}
	}
	for (int k = 1; k<=n; k++){
		for (int i = 1; i<=k; i++){
			for (int j = 1; j<=k; j++){
				dp[i][j]=min(dp[i][j],dp[i][k]+dp[k][j]);
			}
		}
	}
	for (int i = 1; i<=n; i++){
		for (int j = i+1; j<=n; j++){
			wyn[dp[i][j]]++;
		}
	}
	for (int i = 1; i<=R; i++){
		Answer(i,wyn[i]);
	}
}

詳細信息

implementer.cpp: In function ‘int main()’:
implementer.cpp:94:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   94 |                 scanf("%d", &(n_roads[i]));
      |                 ~~~~~^~~~~~~~~~~~~~~~~~~~~
implementer.cpp:98:30: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   98 |                         scanf("%d", &(road[i][j]));
      |                         ~~~~~^~~~~~~~~~~~~~~~~~~~~
implementer.cpp:105:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
  105 |                 scanf("%d", &(expected_answer[i]));
      |                 ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
answer.code:2:10: error: #include expects "FILENAME" or <FILENAME>
    2 | #include dungeon.h
      |          ^~~~~~~
answer.code: In function ‘void dfs(int, int)’:
answer.code:18:25: error: ‘LastRoad’ was not declared in this scope
   18 |                 fat[v]={LastRoad(),p};
      |                         ^~~~~~~~
answer.code:18:37: error: no match for ‘operator=’ (operand types are ‘std::pair<int, int>’ and ‘<brace-enclosed initializer list>’)
   18 |                 fat[v]={LastRoad(),p};
      |                                     ^
In file included from /usr/include/c++/13/bits/stl_algobase.h:64,
                 from /usr/include/c++/13/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/13/bits/stdc++.h:51,
                 from answer.code:1:
/usr/include/c++/13/bits/stl_pair.h:439:9: note: candidate: ‘template<class _U1, class _U2> constexpr std::pair<_T1, _T2>& std::pair<_T1, _T2>::operator=(const std::pair<_U1, _U2>&) requires  _S_assignable<const _U1&, const _U2&>() [with _U2 = _U1; _T1 = int; _T2 = int]’
  439 |         operator=(const pair<_U1, _U2>& __p)
      |         ^~~~~~~~
/usr/include/c++/13/bits/stl_pair.h:439:9: note:   template argument deduction/substitution failed:
answer.code:18:37: note:   couldn’t deduce template parameter ‘_U1’
   18 |                 fat[v]={LastRoad(),p};
      |                                     ^
/usr/include/c++/13/bits/stl_pair.h:451:9: note: candidate: ‘template<class _U1, class _U2> constexpr std::pair<_T1, _T2>& std::pair<_T1, _T2>::operator=(std::pair<_U1, _U2>&&) requires  _S_assignable<_U1, _U2>() [with _U2 = _U1; _T1 = int; _T2 = int]’
  451 |         operator=(pair<_U1, _U2>&& __p)
      |         ^~~~~~~~
/usr/include/c++/13/bits/stl_pair.h:451:9: note:   template argument deduction/substitution failed:
answer.code:18:37: note:   couldn’t deduce template parameter ‘_U1’
   18 |                 fat[v]={LastRoad(),p};
      |                                     ^
/usr/include/c++/13/bits/stl_pair.h:416:7: note: candidate: ‘constexpr std::pair<_T1, _T2>& std::pair<_T1, _T2>::operator=(const std::pair<_T1, _T2>&) requires  _S_assignable<const _T1&, const _T2&>() [with _T1 = int; _T2 = int]’
  416 |       operator=(const pair& __p)
      |       ^~~~~~~~
/usr/include/c++/13/bits/stl_pair.h:416:29: note:   no known conversion for argument 1 from ‘<brace-enclosed initializer list>’ to ‘const std::pair<int, int>&’
  416 |       operator=(const pair& __p)
      |                 ~~~~~~~~~~~~^~~
/usr/include/c++/13/bits/stl_pair.h:427:7: note: candidate: ‘constexpr std::pair<_T1, _T2>& std::pair<_T1, _T2>::operator=(std::pair<_T1, _T2>&&) requires  _S_assignable<_T1, _T2>() [with _T1 = int; _T2 = int]’
  427 |       operator=(pair&& __p)
      |       ^~~~~~~~
/usr/include/c++/13/bits/stl_pair.h:427:24: note:   no known conversion for argument 1 from ‘<brace-enclosed initializer list>’ to ‘std::pair<int, int>&&’
  427 |       operator=(pair&& __p)
      |                 ~~~~~~~^~~
answer.code:21:16: error: ‘NumberOfRoads’ was not declared in this scope
   21 |         deg[v]=NumberOfRoads();
      |                ^~~~~~~~~~~~~
answer.code:24:17: error: ‘Move’ was not declared in this scope; did you mean ‘remove’?
   24 |                 Move(i,2);
      |                 ^~~~
      |                 remove
answer.code:25:21: error: ‘Color’ was not declared in this scope
   25 |                 if (Color()==2)Move(LastRoad(),2);
      |                     ^~~~~
answer.code:25:37: error: ‘LastRoad’ was not declared in this scope
   25 |                 if (Color()==2)Move(LastRoad(),2);
      |                                     ^~~~~~~~
answer.code:32:18: error: ‘Move’ was not declared in this scope; did you mean ‘remove’?
   32 |         if (v!=1)Move(fat[v].first,2);
      |                  ^~~~
      |                  remove
answer.code: In function ‘void MyMove(int, int)’:
answer.code:48:38: error: ‘Color’ was not declared in this scope
   48 |         Move(sciezki[a][b][0].second,Color());
      |                                      ^~~~~
answer.code:48:9: error: ‘Move’ was not declared in this scope;...