QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#394039#6539. Treasure Boxstarback24Compile Error//C++142.3kb2024-04-19 21:31:262024-04-19 21:31:28

Judging History

你现在查看的是最新测评结果

  • [2024-04-19 21:31:28]
  • 评测
  • [2024-04-19 21:31:26]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;

#define endl '\n'
#define inf 0x3f3f3f3f
#define INF 0x3f3f3f3f3f3f3f3f
#define mkp make_pair
#define pb push_back
#define fir first
#define pp pop_back
#define eps 1e-8
#define sec second
#define pii pair<int,int>
#define eb emplace_back
#define file(filename) freopen(filename".in","r",stdin);freopen(filename".out","w",stdout);
#define For(i,a,b) for(int i=a;i<=b;i++)
#define Dor(i,a,b) for(int i=a;i>=b;i--)
//==============================================================================================
// Fast IO

template<typename T>
inline T read(){
	T f=1,c=0;
	char ch=getchar();
	while(!isdigit(ch)){
		if(ch=='-'){
			f=-1;
		}
		ch=getchar();
	}
	while(isdigit(ch)){
		c=(c<<1)+(c<<3)+(ch^48);
		ch=getchar();
	}
	T a=f*c;
	return a;
}

//=============================================================================================
//code here
char ch[1001000];
ll a1[1001000],a2[1001000];
int n,c,h[1001000];
void add(int x,int y,ll  w){
	a1[x]=min(a1[x],w);
	a2[x]=min(a2[x],w);
	a1[y]=min(a1[y],w);
	a2[y]=min(a2[y],w);
}
void solve(){
	cin>>n>>c;
	For(i,1,n){
		cin>>ch[i];
	}
	For(i,1,n){
		cin>>h[i];
	}
	int l=1,r=n;
	while(l<r&&ch[l]==ch[r]){
		l++,r--;
	}
	if(l==r){
		For(i,1,n){
			cout<<"0 ";
		}
		cout<<endl;
		return;
	}
	fill(a1,a1+n+2,sizeof(a1));
	fill(a2,a2+n+2,sizeof(a2));
	int p=n/2;
	ll sum=0;
	while(ch[p]==ch[n-p+1]){
		p--;
	}
	For(i,l,r){
		if(ch[i]!=ch[n-i+1]){
			if(i<=n/2){
				sum+=h[i];
			}
			else{
				sum+=min(h[i],h[n-i+1])-h[n-i+1];
			}
		}
		if(i>=p){
			add(i,sum+1ll*(i-l)*c);
			add(l,sum+1ll*(i-l)*c);
		}
	}
	sum=0;
	p=n-p+1;
	Dor(i,r,l){
		if(ch[i]!=ch[n-i+1]){
			if(i>n/2){
				sum+=h[i];
			}
			else{
				sum+=min(h[i],h[n-i+1])-h[n-i+1];
			}
		}
		if(i<=p){
			add(i,sum+1ll*(r-i)*c);
			add(r,sum+1ll*(r-i)*c);
		}
	}
	For(i,1,n){
		a1[i]=min(a1[i-1]+c,a1[i]);
	}
	Dor(i,n,1){
		a2[i]=min(a2[i+1]+c,a2[i]);
	}
	For(i,1,n){
		cout<<min(a1[i],a2[i])<<" ";
	}
	cout<<endl;
}
signed main(){
	int t;
	cin>>t;
	while(t--){
		solve();
	}
}
//吾日三省吾身
//输入多而不read()乎?
//1e18而不开longlong乎?
//多测不清乎?

Details

answer.code: In function ‘void solve()’:
answer.code:89:28: error: too few arguments to function ‘void add(int, int, ll)’
   89 |                         add(i,sum+1ll*(i-l)*c);
      |                         ~~~^~~~~~~~~~~~~~~~~~~
answer.code:47:6: note: declared here
   47 | void add(int x,int y,ll  w){
      |      ^~~
answer.code:90:28: error: too few arguments to function ‘void add(int, int, ll)’
   90 |                         add(l,sum+1ll*(i-l)*c);
      |                         ~~~^~~~~~~~~~~~~~~~~~~
answer.code:47:6: note: declared here
   47 | void add(int x,int y,ll  w){
      |      ^~~
answer.code:105:28: error: too few arguments to function ‘void add(int, int, ll)’
  105 |                         add(i,sum+1ll*(r-i)*c);
      |                         ~~~^~~~~~~~~~~~~~~~~~~
answer.code:47:6: note: declared here
   47 | void add(int x,int y,ll  w){
      |      ^~~
answer.code:106:28: error: too few arguments to function ‘void add(int, int, ll)’
  106 |                         add(r,sum+1ll*(r-i)*c);
      |                         ~~~^~~~~~~~~~~~~~~~~~~
answer.code:47:6: note: declared here
   47 | void add(int x,int y,ll  w){
      |      ^~~