QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#780120 | #9810. Obliviate, Then Reincarnate | 1124828077 | Compile Error | / | / | C++14 | 1.5kb | 2024-11-25 01:27:44 | 2024-11-25 01:27:45 |
Judging History
This is the latest submission verdict.
- [2024-11-26 23:19:26]
- hack成功,自动添加数据
- (/hack/1260)
- [2024-11-25 01:27:45]
- Judged
- Verdict: Compile Error
- Time: 0ms
- Memory: 0kb
- [2024-11-25 01:27:44]
- Submitted
answer
#include<cstdio>
#include<algorithm>
#include<vector>
#include<cstdlib>
using namespace std;
const long long INF=1e18;
int n,m,q,cnt,fl[500005],ft[500005];
long long stk[500005];
typedef struct{
int to,dis;
}P;
vector<P>g[500005];
vector<long long>d[500005];
void dfs(int x,long long y){
fl[x]=cnt;stk[x]=y;
for (int i=0;i<g[x].size();i++)
if (!fl[g[x][i].to])
{
d[g[x][i].to].push_back(y+g[x][i].dis);
dfs(g[x][i].to,y+g[x][i].dis);
}
else if (fl[g[x][i].to]==cnt)
{
if (stk[g[x][i].to]!=INF)
{
if (y+g[x][i].dis!=stk[g[x][i].to])ft[x]=1;
}
else
{
if (n==350639)printf("aaaa\n")
if (d[g[x][i].to].size()<2 && y+g[x][i].dis!=d[g[x][i].to][d[g[x][i].to].size()-1])
{
d[g[x][i].to].push_back(y+g[x][i].dis);
dfs(g[x][i].to,y+g[x][i].dis);
}
}
}
stk[x]=INF;
}
void dfs2(int x){
if (ft[x])return;
ft[x]=-1;
for (int i=0;i<g[x].size();i++)
{
dfs2(g[x][i].to);
if (ft[g[x][i].to]==1)ft[x]=1;
}
}
int main()
{
scanf("%d%d%d",&n,&m,&q);
for (int i=1;i<=m;i++)
{
int a,b;
scanf("%d%d",&a,&b);
P aa;aa.to=((a%n+b%n)%n+n)%n;aa.dis=b;
g[(a%n+n)%n].push_back(aa);
}
for (int i=0;i<n;i++)stk[i]=INF;
for (int i=0;i<n;i++)
if (!fl[i])
{
cnt++;d[i].push_back(0);
dfs(i,0);
}
while(q--)
{
int a;
scanf("%d",&a);a=(a%n+n)%n;
if (ft[a]==1)puts("Yes");
else if (ft[a]==-1)puts("No");
else
{
dfs2(a);
if (ft[a]==1)puts("Yes");
else if (ft[a]==-1)puts("No");
}
}
return 0;
}
詳細信息
answer.code: In function ‘void dfs(int, long long int)’: answer.code:30:55: error: expected ‘;’ before ‘if’ 30 | if (n==350639)printf("aaaa\n") | ^ | ; 31 | if (d[g[x][i].to].size()<2 && y+g[x][i].dis!=d[g[x][i].to][d[g[x][i].to].size()-1]) | ~~ answer.code: In function ‘int main()’: answer.code:51:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 51 | scanf("%d%d%d",&n,&m,&q); | ~~~~~^~~~~~~~~~~~~~~~~~~ answer.code:55:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 55 | scanf("%d%d",&a,&b); | ~~~~~^~~~~~~~~~~~~~ answer.code:69:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 69 | scanf("%d",&a);a=(a%n+n)%n; | ~~~~~^~~~~~~~~