QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#618034 | #8237. Sugar Sweet II | ukuk | Compile Error | / | / | C++20 | 3.0kb | 2024-10-06 18:13:53 | 2024-10-06 18:14:09 |
Judging History
你现在查看的是最新测评结果
- [2024-11-04 16:59:03]
- hack成功,自动添加数据
- (/hack/1109)
- [2024-10-06 18:14:09]
- 评测
- 测评结果:Compile Error
- 用时:0ms
- 内存:0kb
- [2024-10-06 18:13:53]
- 提交
answer
#include<bits/stdc++.h>
#define ls i<<1
#define rs i<<1|1
#define fi first
#define se second
#define min amin
#define max amax
#define eb emplace_back
using namespace std;
using ll=long long;
using LL=__int128;
using pii=pair<int,int>;
const int N=5E5+10;
const int inf=1E9;
const int p=1E9+7;
template<typename T=int>T read(){T x;cin>>x;return x;}
template<typename U,typename V>U min(const U &x,const V &y){return x<y?x:y;}
template<typename U,typename V>U max(const U &x,const V &y){return y<x?x:y;}
template<typename U,typename ...V>U min(const U &x,const V &...y){return min(x,min(y...));}
template<typename U,typename ...V>U max(const U &x,const V &...y){return max(x,max(y...));}
template<typename U,typename V>bool cmin(U &x,const V &y){return y<x?x=y,true:false;}
template<typename U,typename V>bool cmax(U &x,const V &y){return x<y?x=y,true:false;}
template<typename T>T qpow(T x,int n){T y=1;for(;n;n>>=1,x*=x)if(n&1)y*=x;return y;}
istream &operator>>(istream &is,LL &x){string a;is>>a;bool k=a[0]=='-';if(k)a=a.substr(1);x=0;for(char &t:a)x=x*10+t-48;if(k)x=-x;return is;}
ostream &operator<<(ostream &os,LL x){if(x<0)os<<'-',x=-x;string a;do a+=x%10|48;while(x/=10);reverse(a.begin(),a.end());return os<<a;}
struct mint{
int x;
mint():x(){}
mint(const int &x):x(x<0?x+p:x){}
mint inv()const{return qpow(*this,p-2);}
mint &operator+=(const mint &t){return (x+=t.x)<p?0:x-=p,*this;}
mint &operator-=(const mint &t){return (x-=t.x)<0?x+=p:0,*this;}
mint &operator*=(const mint &t){return x=ll(x)*t.x%p,*this;}
mint &operator/=(const mint &t){return *this*=t.inv();}
mint operator+(const mint &t)const{return mint(*this)+=t;}
mint operator-(const mint &t)const{return mint(*this)-=t;}
mint operator*(const mint &t)const{return mint(*this)*=t;}
mint operator/(const mint &t)const{return mint(*this)/=t;}
bool operator==(const mint &t)const{return x==t.x;}
friend istream &operator>>(istream &is,mint &t){return is>>t.x;}
friend ostream &operator<<(ostream &os,const mint &t){return os<<t.x;}
};
int a[N],b[N],c[N],h[N];
bool vis[N];
mint ifac[N];
void init(){
ifac[0]=ifac[1]=1;
for(int i=2;i<N;++i)ifac[i]=ifac[p%i]*(-p/i);
for(int i=2;i<N;++i)ifac[i]*=ifac[i-1];
}
void dfs(int x){
vis[x]=true;
int y=b[x];
if(a[x]<a[y])h[x]=1;
else if(a[x]>=a[y]+c[y])h[x]=0;
else{
if(!vis[y])dfs(y);
h[x]=h[y]?h[y]+1:0;
}
}
void solve(){
int n;
cin>>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>>c[i];
for(int i=1;i<=n;++i){
if(!vis[i]){
dfs(i);
}
}
for(int i=1;i<=n;++i){
if(h[i]){
cout<<ifac[h[i]]*c[i]+a[i]<<' ';
h[i]=0;
}
else cout<<a[i]<<' ';
vis[i]=false;
}
cout<<'\n';
}
int main(){
ios::sync_with_stdio(false);
cin.tie(nullptr);
init();
int T;
cin>>T;
while(T--)solve();
return 0;
}
Details
answer.code:43:1: error: extended character is not valid in an identifier 43 | | ^ answer.code:43:1: error: ‘ ’ does not name a type 43 | | ^ answer.code: In function ‘void dfs(int)’: answer.code:54:11: error: ‘b’ was not declared in this scope 54 | int y=b[x]; | ^ answer.code:55:8: error: ‘a’ was not declared in this scope 55 | if(a[x]<a[y])h[x]=1; | ^ answer.code:55:18: error: ‘h’ was not declared in this scope 55 | if(a[x]<a[y])h[x]=1; | ^ answer.code:56:24: error: ‘c’ was not declared in this scope 56 | else if(a[x]>=a[y]+c[y])h[x]=0; | ^ answer.code:56:29: error: ‘h’ was not declared in this scope 56 | else if(a[x]>=a[y]+c[y])h[x]=0; | ^ answer.code:59:9: error: ‘h’ was not declared in this scope 59 | h[x]=h[y]?h[y]+1:0; | ^ answer.code: In function ‘void solve()’: answer.code:65:31: error: ‘a’ was not declared in this scope 65 | for(int i=1;i<=n;++i)cin>>a[i]; | ^ answer.code:66:31: error: ‘b’ was not declared in this scope 66 | for(int i=1;i<=n;++i)cin>>b[i]; | ^ answer.code:67:31: error: ‘c’ was not declared in this scope 67 | for(int i=1;i<=n;++i)cin>>c[i]; | ^ answer.code:74:12: error: ‘h’ was not declared in this scope 74 | if(h[i]){ | ^ answer.code:75:30: error: ‘c’ was not declared in this scope 75 | cout<<ifac[h[i]]*c[i]+a[i]<<' '; | ^ answer.code:75:35: error: ‘a’ was not declared in this scope 75 | cout<<ifac[h[i]]*c[i]+a[i]<<' '; | ^ answer.code:78:20: error: ‘a’ was not declared in this scope 78 | else cout<<a[i]<<' '; | ^