QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#747161 | #9731. Fuzzy Ranking | Kir1same | Compile Error | / | / | C++14 | 1.9kb | 2024-11-14 16:29:05 | 2024-11-14 16:29:05 |
Judging History
你现在查看的是最新测评结果
- [2024-11-25 12:28:53]
- hack成功,自动添加数据
- (/hack/1257)
- [2024-11-14 16:29:05]
- 评测
- 测评结果:Compile Error
- 用时:0ms
- 内存:0kb
- [2024-11-14 16:29:05]
- 提交
answer
#include <bits/stdc++.h>
#define ll long long
using namespace std;
const int N=2e5+10;
int low[N],dfn[N],stk[N],in[N],col[N],top,cnt1,cnt,T,n,k,q;
vector<int> l[N],r[N],v[N],g[N];vector<ll> s[N];
void dfs(int p)
{
dfn[p]=low[p]=++cnt;
stk[++top]=p;in[p]=true;
for(int i=0;i<g[p].size();i++)
{
int to=g[p][i];
if(!dfn[to])
{
dfs(to);
low[p]=min(low[p],low[to]);
}
else
if(in[to])
low[p]=min(low[p],dfn[to]);
}
if(dfn[p]==low[p])
{
cnt1++;
while(top&&stk[top+1]!=p)
{
col[stk[top]]=cnt1;
in[stk[top--]]=false;
}
}
}
int main()
{
scanf("%d",&T);
while(T--)
{
scanf("%d %d %d",&n,&k,&q);
cnt1=cnt=0;top=0;
for(int i=1;i<=k;i++)
v[i]=vector(n+1,0),l[i]=vector(n+1,0),r[i]=vector(n+1,0),s[i]=vector(n+1,0ll);
for(int i=1;i<=n;i++)
g[i].clear(),in[i]=false,col[i]=0,dfn[i]=0,low[i]=0,stk[i]=0;
for(int i=1;i<=k;i++)
for(int j=1;j<=n;j++)
{
scanf("%d",&v[i][j]);
if(j>1)
g[v[i][j-1]].push_back(v[i][j]);
}
for(int i=1;i<=n;i++)
if(!dfn[i])
dfs(i);
for(int i=1;i<=k;i++)
{
int num=0;
for(int j=1;j<=n;j++)
{
if(j!=1&&col[v[i][j]]!=col[v[i][j-1]])
{
s[i][j-1]+=1ll*num*(num-1)/2;
for(int x=j-1;x>=j-num;x--)
r[i][x]=j-1,l[i][x]=j-num;
num=0;
}
s[i][j]+=s[i][j-1];
num++;
}
s[i][n]+=1ll*num*(num-1)/2;
for(int x=n;x>=n-num+1;x--)
r[i][x]=n,l[i][x]=n-num+1;
}
ll lasans=0;
while(q--)
{
int id,l1,r1;ll ans=0;
scanf("%d %d %d",&id,&l1,&r1);
id=(id+lasans)%k+1;
l1=(l1+lasans)%k+1;
r1=(r1+lasans)%k+1;
if(r[id][r1]==r[id][l1])
ans=(1ll*(r1-l1)*(r1-l1+1)/2);
else
ans=1ll*(r[id][l1]-l1)*(r[id][l1]-l1+1)/2+1ll*(r1-l[id][r1]+1)*(r1-l[id][r1])/2+s[id][l[id][r1]-1]-s[id][r[id][l1]];
printf("%lld\n",ans);
lasans=ans;
}
}
}
詳細信息
answer.code: In function ‘int main()’: answer.code:41:36: error: missing template arguments before ‘(’ token 41 | v[i]=vector(n+1,0),l[i]=vector(n+1,0),r[i]=vector(n+1,0),s[i]=vector(n+1,0ll); | ^ answer.code:41:55: error: missing template arguments before ‘(’ token 41 | v[i]=vector(n+1,0),l[i]=vector(n+1,0),r[i]=vector(n+1,0),s[i]=vector(n+1,0ll); | ^ answer.code:41:74: error: missing template arguments before ‘(’ token 41 | v[i]=vector(n+1,0),l[i]=vector(n+1,0),r[i]=vector(n+1,0),s[i]=vector(n+1,0ll); | ^ answer.code:41:93: error: missing template arguments before ‘(’ token 41 | v[i]=vector(n+1,0),l[i]=vector(n+1,0),r[i]=vector(n+1,0),s[i]=vector(n+1,0ll); | ^ answer.code:35:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 35 | scanf("%d",&T); | ~~~~~^~~~~~~~~ answer.code:38:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 38 | scanf("%d %d %d",&n,&k,&q); | ~~~~~^~~~~~~~~~~~~~~~~~~~~ answer.code:47:38: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 47 | scanf("%d",&v[i][j]); | ~~~~~^~~~~~~~~~~~~~~ answer.code:77:30: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 77 | scanf("%d %d %d",&id,&l1,&r1); | ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~