QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#307798 | #5034. >.< | lnyx | Compile Error | / | / | C++14 | 2.4kb | 2024-01-19 09:34:36 | 2024-01-19 09:34:36 |
Judging History
This is the latest submission verdict.
- [2024-01-19 09:34:36]
- Judged
- Verdict: Compile Error
- Time: 0ms
- Memory: 0kb
- [2024-01-19 09:34:36]
- Submitted
answer
// 距离退役还有 44 天
#include<cstdio>
#include<iostream>
#include<queue>
#include<vector>
#include<ctime>
#define eb emplace_back
using namespace std;
namespace IO{
template<typename T> inline void rd(T &x){
x=0; bool f=0; char c=getchar();
while(c<'0'||c>'9') f|=c=='-',c=getchar();
while('0'<=c&&c<='9') x=((x<<3)+(x<<1))+(c^48),c=getchar();
x=f?-x:x;
}
template<typename T,typename ...Args> inline void rd(T &x,Args &...args){ rd(x),rd(args...); }
template<typename T> inline void wt(char c,T x){
static int stk[114]; int top=0;
if(x<0) x=-x,putchar('-');
do stk[++top]=x%10,x/=10; while(x);
while(top) putchar(stk[top--]+'0');
putchar(c);
}
template<typename T,typename ...Args> inline void wt(char c,T x,Args ...args){ wt(c,x),wt(c,args...); }
template<typename T,typename ...Args> inline void wt(char c1,char c2,T x,Args ...args){ wt(c2,x),wt(c2,args...),putchar(c1); }
}
using IO::rd;
using IO::wt;
typedef long long LL;
typedef pair<LL,LL> PLL;
const LL INF=1e18;
const int N=1007;
int n,m,K;
int tr[N][N],val[N],ne[N],idx;
bool flag[N];
int p[N],cnt;
vector<PLL>g[N];
inline void ins(int x){
int u=0;
for(int i=1;i<=cnt;i++){
if(!tr[u][p[i]]) tr[u][p[i]]=++idx;
u=tr[u][p[i]],val[u]=p[i];
}
flag[u]=x;
}
inline void build(){
queue<int>q;
for(int i=1;i<=n;i++){
if(tr[0][i]) q.push(tr[0][i]);
}
while(q.size()){
int u=q.front(); q.pop();
for(int i=1;i<=n;i++){
int &v=tr[u][i];
if(!tr[u][i]) v=tr[ne[u]][i];
else{
ne[v]=tr[ne[u]][i];
q.push(v);
}
}
}
}
LL dist[N];
inline LL dij(int S){
for(int i=0;i<=idx;i++) dist[i]=INF;
priority_queue<PLL>q;
dist[S]=0,q.push({0,S});
int ans=INF;
while(q.size()){
int u=q.top().second; q.pop();
if(flag[u]) continue;
flag[u]=1;
for(PLL A:g[val[u]]){
int v=tr[u][A.first],w=A.second;
if(flag[v]) continue;
if(dist[v]>dist[u]+w){
dist[v]=dist[u]+w,q.push({-dist[v],v});
if(val[v]==n) ans=min(ans,dist[v]);
}
}
}
return ans;
}
int main(){
#ifndef ONLINE_JUDGE
freopen("in.in","r",stdin);
freopen("out.out","w",stdout);
#endif
rd(n,m,K);
for(int i=1;i<=m;i++){
int u,v,w; rd(u,v,w);
g[u].eb(v,w);
}
while(K--){
rd(cnt);
for(int i=1;i<=cnt;i++) rd(p[i]);
ins(1);
}
for(int i=1;i<=n;i++) p[cnt=1]=i,ins(0);
build();
wt('\n',dij(tr[0][1]));
// for(int i=0;i<=idx;i++) cerr<<flag[i]<<" ";
return 0;
}
詳細信息
answer.code: In function ‘LL dij(int)’: answer.code:68:17: warning: overflow in conversion from ‘LL’ {aka ‘long long int’} to ‘int’ changes value from ‘1000000000000000000’ to ‘-1486618624’ [-Woverflow] 68 | int ans=INF; | ^~~ answer.code:78:54: error: no matching function for call to ‘min(int&, LL&)’ 78 | if(val[v]==n) ans=min(ans,dist[v]); | ~~~^~~~~~~~~~~~~ In file included from /usr/include/c++/13/string:51, from /usr/include/c++/13/bits/locale_classes.h:40, from /usr/include/c++/13/bits/ios_base.h:41, from /usr/include/c++/13/ios:44, from /usr/include/c++/13/ostream:40, from /usr/include/c++/13/iostream:41, from answer.code:3: /usr/include/c++/13/bits/stl_algobase.h:233:5: note: candidate: ‘template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)’ 233 | min(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/13/bits/stl_algobase.h:233:5: note: template argument deduction/substitution failed: answer.code:78:54: note: deduced conflicting types for parameter ‘const _Tp’ (‘int’ and ‘LL’ {aka ‘long long int’}) 78 | if(val[v]==n) ans=min(ans,dist[v]); | ~~~^~~~~~~~~~~~~ /usr/include/c++/13/bits/stl_algobase.h:281:5: note: candidate: ‘template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)’ 281 | min(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/13/bits/stl_algobase.h:281:5: note: template argument deduction/substitution failed: answer.code:78:54: note: deduced conflicting types for parameter ‘const _Tp’ (‘int’ and ‘LL’ {aka ‘long long int’}) 78 | if(val[v]==n) ans=min(ans,dist[v]); | ~~~^~~~~~~~~~~~~