QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#64153 | #4666. Delete And Win | BMTXLRC | Compile Error | / | / | C++14 | 1.2kb | 2022-11-24 10:21:39 | 2022-11-24 10:21:40 |
Judging History
你现在查看的是最新测评结果
- [2023-08-10 23:21:45]
- System Update: QOJ starts to keep a history of the judgings of all the submissions.
- [2022-11-24 10:21:40]
- 评测
- 测评结果:Compile Error
- 用时:0ms
- 内存:0kb
- [2022-11-24 10:21:39]
- 提交
answer
#include<bits/stdc++.h>
#define int long long
#define mid ((l+r)>>1)
using namespace std;
const int N=5e5+5;
inline int read(){
char op=getchar();
int w=0,s=1;
while(op<'0'||op>'9'){
if(op=='-') s=-1;
op=getchar();
}
while(op>='0'&&op<='9'){
w=(w<<1)+(w<<3)+op-'0';
op=getchar();
}
return w*s;
}
int dp[N][2];
char s[N],t[N];
vector<int> v[28];
signed main(){
scanf("%s",t+1),scanf("%s",s+1);
int n=strlen(s+1),m=strlen(t+1);
for(register int i=1;i<=m;i++){
int ch=t[i]-'a'+1;
v[ch].push_back(i);
}
int ans=1e18;
for(register int i=1;i<=n;i++){
int ch=s[i]-'a'+1;
vector<int>::iterator k=upper_bound(v[ch].begin(),v[ch].end(),dp[i-1][0]);
if(k!=v[ch].end()) dp[i][0]=*k;
else dp[i][0]=inf;
dp[i][1]=inf;
for(register int j=1;j<ch;j++){
k=upper_bound(v[j].begin(),v[j].end(),dp[i-1][0]);
if(k!=v[j].end()) dp[i][1]=min(dp[i][1],*k);
}
if(dp[i][0]==inf&&dp[i][1]==inf&&dp[i-1][0]!=inf) ans=min(ans,m-i+1);
if(dp[i][0]>0&&dp[i][0]!=inf) ans=min(ans,m-i+1);
ans=min(ans,dp[i][1]-i);
}
printf("%lld",ans);
}
Details
answer.code: In function ‘int main()’: answer.code:34:23: error: ‘inf’ was not declared in this scope; did you mean ‘ynf’? 34 | else dp[i][0]=inf; | ^~~ | ynf answer.code:35:18: error: ‘inf’ was not declared in this scope; did you mean ‘ynf’? 35 | dp[i][1]=inf; | ^~~ | ynf answer.code:23:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 23 | scanf("%s",t+1),scanf("%s",s+1); | ~~~~~^~~~~~~~~~ answer.code:23:26: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 23 | scanf("%s",t+1),scanf("%s",s+1); | ~~~~~^~~~~~~~~~