QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#120816#6660. 택시 여행youngsystem#Compile Error//C++201.5kb2023-07-07 11:31:582024-07-04 00:25:28

Judging History

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

  • [2024-07-04 00:25:28]
  • 评测
  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-07-07 11:31:58]
  • 提交

answer

#include <bits/stdc++.h>
long long a[200005],b[200005];
vector<int>v[200005];
vector<long long>bq[200005];
int pos[200005],cnt;
bool bi(int x,int y)
{
	return b[x]>b[y];
}
long long dep[200005];
void dfs(int x,int f)
{
	if(f==0)dep[x]=0;
	for(int i=0;i<v[x].size();i++)
	{
		if(v[x][i]==f)continue;
		dep[v[x][i]]=dep[x]+bq[x][i];
		dfs(v[x][i],x);
	}
}
long long dis[200005];
std::vector<long long> travel(std::vector<long long> A,
        std::vector<int> B, std::vector<int> U, std::vector<int> V, std::vector<int> W)
{
    int n = A.size();
    for(int i=1;i<=n;i++)a[i]=A[i-1],b[i]=B[i-1];
    int sl=0;
    for(int i=1;i<=n;i++)if(b[i]!=0)sl++;
    for(int i=0;i<n-1;i++)
    {
    	v[U[i]].push_back(V[i]);
    	v[V[i]].push_back(U[i]);
    	bq[U[i]].push_back(W[i]);
    	bq[V[i]].push_back(W[i]);
	}
	dis[1]=0;
	for(int i=2;i<=n;i++)dis[i]=1000000000000000000LL;
    if(sl<=2000)
    {
    	for(int i=1;i<=n;i++)if(b[i]!=0)pos[++cnt]=i;
    	sort(pos+1,pos+cnt+1,bi);
    	for(int ii=1;ii<=cnt;ii++)
    	{
    		int i=pos[ii];
    		if(dis[i]==1000000000000000000LL)continue;
    		dfs(i,0);
    		for(int j=1;j<=n;j++)
    		{
    			dis[j]=min(dis[j],dis[i]+a[i]+b[i]*dep[j]);
			}
		}
		long long minn=1000000000000000000LL;
		for(int i=1;i<=n;i++)if(b[i]==0)minn=min(minn,dis[i]+a[i]);
		for(int i=1;i<=n;i++)dis[i]=min(dis[i],minn);
		vector<long long>qans;
		for(int i=2;i<=n;i++)qans.push_back(dis[i]);
		return qans;
	}
	vector<long long>v;
	for(int i=2;i<=n;i++)v.push_back(0);
	return v;
}

Details

answer.code:3:1: error: ‘vector’ does not name a type
    3 | vector<int>v[200005];
      | ^~~~~~
answer.code:4:1: error: ‘vector’ does not name a type
    4 | vector<long long>bq[200005];
      | ^~~~~~
answer.code: In function ‘void dfs(int, int)’:
answer.code:14:23: error: ‘v’ was not declared in this scope
   14 |         for(int i=0;i<v[x].size();i++)
      |                       ^
answer.code:17:37: error: ‘bq’ was not declared in this scope; did you mean ‘bi’?
   17 |                 dep[v[x][i]]=dep[x]+bq[x][i];
      |                                     ^~
      |                                     bi
answer.code: In function ‘std::vector<long long int> travel(std::vector<long long int>, std::vector<int>, std::vector<int>, std::vector<int>, std::vector<int>)’:
answer.code:31:9: error: ‘v’ was not declared in this scope
   31 |         v[U[i]].push_back(V[i]);
      |         ^
answer.code:33:9: error: ‘bq’ was not declared in this scope; did you mean ‘bi’?
   33 |         bq[U[i]].push_back(W[i]);
      |         ^~
      |         bi
answer.code:41:9: error: ‘sort’ was not declared in this scope
   41 |         sort(pos+1,pos+cnt+1,bi);
      |         ^~~~
answer.code:41:9: note: suggested alternatives:
In file included from /usr/include/c++/13/algorithm:73,
                 from /usr/include/x86_64-linux-gnu/c++/13/bits/stdc++.h:51,
                 from answer.code:1:
/usr/include/c++/13/pstl/glue_algorithm_defs.h:296:1: note:   ‘std::sort’
  296 | sort(_ExecutionPolicy&& __exec, _RandomAccessIterator __first, _RandomAccessIterator __last);
      | ^~~~
In file included from /usr/include/c++/13/algorithm:63:
/usr/include/c++/13/bits/ranges_algo.h:1801:30: note:   ‘std::ranges::sort’
 1801 |   inline constexpr __sort_fn sort{};
      |                              ^~~~
answer.code:49:32: error: ‘min’ was not declared in this scope
   49 |                         dis[j]=min(dis[j],dis[i]+a[i]+b[i]*dep[j]);
      |                                ^~~
answer.code:49:32: note: suggested alternatives:
In file included from /usr/include/c++/13/algorithm:61:
/usr/include/c++/13/bits/stl_algo.h:5785:5: note:   ‘std::min’
 5785 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
In file included from /usr/include/c++/13/bits/ranges_algo.h:39:
/usr/include/c++/13/bits/ranges_util.h:733:29: note:   ‘std::ranges::min’
  733 |   inline constexpr __min_fn min{};
      |                             ^~~
answer.code:53:54: error: ‘min’ was not declared in this scope
   53 |                 for(int i=1;i<=n;i++)if(b[i]==0)minn=min(minn,dis[i]+a[i]);
      |                                                      ^~~
answer.code:53:54: note: suggested alternatives:
/usr/include/c++/13/bits/stl_algo.h:5785:5: note:   ‘std::min’
 5785 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/13/bits/ranges_util.h:733:29: note:   ‘std::ranges::min’
  733 |   inline constexpr __min_fn min{};
      |                             ^~~
answer.code:54:45: error: ‘min’ was not declared in this scope
   54 |                 for(int i=1;i<=n;i++)dis[i]=min(dis[i],minn);
      |                                             ^~~
answer.code:54:45: note: suggested alternatives:
/usr/include/c++/13/bits/stl_algo.h:5785:5: note:   ‘std::min’
 5785 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/13/bits/ranges_util.h:733:29: note:   ‘std::ranges::min’
  733 |   inline constexpr __min_fn min{};
      |                             ^~~
answer.code:55:17: error: ‘vector’ was not declared in this scope
   55 |                 vector<long long>qans;
      |                 ^~~~~~
answer.code:55:17: note: suggested alternatives:
In file included from /usr/include/c++/13/vector:66,
                 from /usr/include/c++/13/functional:64,
                 from /usr/include/x86_64-linux-gnu/c++/13/bits/stdc++.h:53:
/usr/include/c++/13/bits/stl_vector.h:425:11: note:   ‘std::vector’
  425 |     class vector : protected _Vector_base<_Tp, _Alloc>
      |           ^~~~~~
/usr/include/c++/13/vector:86:13: note:   ‘std::pmr::vector’
   86 |       using vector = std::vector<_Tp, polymorphic_allocator<_Tp>>;
      |             ^~~~~~
answer.code:55:24: error: expected primary-expression before ‘long’
   55 |                 vector<long long>qans;
      |                        ^~~~
answer.code:56:38: error: ‘qans’ was not declared in this scope
   56 |                 for(int i=2;i<=n;i++)qans.push_back(dis[i]);
      |                                      ^~~~
answer.code:57:24: error: ‘qans’ was not declared in this scope
   57 |                 return qans;
      |                        ^~~~
answer.code:59:9: error: ‘vector’ was not declared in this scope
   59 |         vector<long long>v;
      |         ^~~~~~
answer.code:59:9: note: suggested alternatives:
/usr/include/c++/13/bits/stl_vector.h:425:11: note:   ‘std::vector’
  425 |     class vector : protecte...