QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#708179 | #8237. Sugar Sweet II | lmcg | Compile Error | / | / | C++20 | 1.5kb | 2024-11-03 20:05:12 | 2024-11-03 20:05:20 |
Judging History
你现在查看的是最新测评结果
- [2024-11-04 16:59:03]
- hack成功,自动添加数据
- (/hack/1109)
- [2024-11-03 20:05:20]
- 评测
- 测评结果:Compile Error
- 用时:0ms
- 内存:0kb
- [2024-11-03 20:05:12]
- 提交
answer
#include<bits/stdc++.h>
using namespace std;
#define int long long
const int MOD = (int)1e9+7;
void add(int &x, int a){if ((x+=a)>=MOD) x-=MOD;}
void mul(int &x, int a){x=x*a%MOD;}
int powe(int x, int p){
int res=1;
while (p>0){if (p&1) mul(res, x); mul(x, x); p>>=1;}
return res;
}
const int N = 5e5+5;
int t, n, A[N], B[N], wt[N], dis[N], ans[N];
int fac[N];
vector<int> G[N];
void dfs(int x){
for (int v : G[x]){
dis[v]=dis[x]+1;
dfs(v);
}
}
signed main(){
ios::sync_with_stdio(0); cin.tie(0);
fac[0]=1;
for (int i=1; i<N; ++i) fac[i]=fac[i-1]*i%MOD;
cin >> t;
while (t--){
cin >> n;
// printf("n=%lld\n", n);
for (int i=1; i<=n; ++i) cin >> A[i];
for (int i=1; i<=n; ++i) cin >> B[i];
for (int i=1; i<=n; ++i) cin >> wt[i];
for (int i=1; i<=n; ++i) dis[i]=0, G[i].clear();
vector<int> vec;
for (int i=1; i<=n; ++i){
if (A[B[i]] > A[i]) dis[i]=1, vec.push_back(i);
else if (A[B[i]]+wt[B[i]] <= A[i]) dis[i]=0;//vec.push_back(i);
else G[B[i]].push_back(i);
}
for (int x : vec){
if (dis[x]>0) dfs(x);
}
// printf("dis:"); for (int i=1; i<=n; ++i) printf("%lld ", dis[i]); puts("");
for (int i=1; i<=n; ++i){
if (dis[i]==0) ans[i]=A[i];
else ans[i] = (A[i] + wt[i]*powe(fac[dis[i]], MOD-2)%MOD)%MOD;
cout << ans[i] << ' ';
}
cout << '\n';
}
return 0;
}
Details
answer.code: In function ‘int main()’: answer.code:41:55: error: unable to find numeric literal operator ‘operator"";’ 41 | else if (A[B[i]]+wt[B[i]] <= A[i]) dis[i]=0;//vec.push_back(i); | ^~~ answer.code:41:55: note: use ‘-fext-numeric-literals’ to enable more built-in suffixes