QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#853524 | #8629. 寻宝 | Prosperity | Compile Error | / | / | C++14 | 1.5kb | 2025-01-11 17:20:59 | 2025-01-11 17:21:05 |
Judging History
answer
#include<bits/stdc++.h>
#include "treasure.h"
#define ll long long
using namespace std;
namespace AAlice{
const int N=1e6+5;
int dis[N];
vector<int>e[N];
void solve(const int T,const int n,const int m,const int x,const int U[],const int V[],bool dir[]){
for(int i=0;i<n;i++) e[i].clear(),dis[i]=1e9+7;
for(int i=0;i<m;i++){
e[U[i]].push_back(V[i]);
e[V[i]].push_back(U[i]);
}
queue<int>q;
q.push(x);dis[x]=0;
while(!q.empty()){
int x=q.front();
q.pop();
for(auto v:e[x])
if(dis[v]>dis[x]+1){
dis[v]=dis[x]+1;
q.push(v);
}
}
for(int i=0;i<m;i++)
if(dis[U[i]]<dis[V[i]]) dir[i]=1;
else dir[i]=0;
}
}
namespace BBob{
const int N=1e6+5;
vector<pair<int,bool> >e;
mt19937 rnd(time(0));
int a[N];
bool check(){
for(auto x:e)
if(x.second==0) return 0;
return 1;
}
int solve(const int T,const int n){
for(int i=0;i<n;i++) a[i]=i;
shuffle(a,a+n,rnd());
for(int i=0;i<n;i++){
e=discover(a[i]);
if(check()) return a[i];
}
return 0;
}
}
void Alice(const int T,const int n,const int m,const int x,const int U[],const int V[],bool dir[]){
AAlice::solve(T,n,m,x,U,V,dir);
}
int Bob(const int T,const int n){
return BBob::solve(T,n);
}
详细
In file included from /usr/include/c++/13/algorithm:61, from /usr/include/x86_64-linux-gnu/c++/13/bits/stdc++.h:51, from answer.code:1: /usr/include/c++/13/bits/stl_algo.h: In instantiation of ‘void std::shuffle(_RAIter, _RAIter, _UGenerator&&) [with _RAIter = int*; _UGenerator = long unsigned int]’: answer.code:48:16: required from here /usr/include/c++/13/bits/stl_algo.h:3763:9: error: ‘std::remove_reference<long unsigned int>::type’ {aka ‘long unsigned int’} is not a class, struct, or union type 3763 | __uc_type; | ^~~~~~~~~ /usr/include/c++/13/bits/stl_algo.h:3791:44: error: ‘std::remove_reference<long unsigned int>::type’ {aka ‘long unsigned int’} is not a class, struct, or union type 3791 | const pair<__uc_type, __uc_type> __pospos = | ^~~~~~~~ /usr/include/c++/13/bits/stl_algo.h:3791:44: error: ‘std::remove_reference<long unsigned int>::type’ {aka ‘long unsigned int’} is not a class, struct, or union type