QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#302688 | #6624. String Problem | ucup-team1004 | WA | 0ms | 5584kb | C++14 | 940b | 2024-01-11 07:12:35 | 2024-01-11 07:12:35 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
#define all(a) (a).begin(),(a).end()
#ifdef DEBUG
template<class T>
ostream& operator << (ostream &out,vector<T> a){
out<<'[';
for(T x:a)out<<x<<',';
return out<<']';
}
template<class T>
vector<T> ary(T *a,int l,int r){
return vector<T>{a+l,a+1+r};
}
template<class T>
void debug(T x){
cerr<<x<<endl;
}
template<class T,class...S>
void debug(T x,S...y){
cerr<<x<<' ',debug(y...);
}
#else
#define debug(...) void()
#endif
const int N=1e6+10;
int n,a[N],ans[N];
char str[N];
int main(){
scanf("%s",str+1),n=strlen(str+1);
for(int i=1;i<=n;i++)a[i]='z'-str[i]+1;
for(int i=1;i<=n;){
ans[i]=i;
int j=i,k=i+1;
for(;k<=n&&a[j]<=a[k];k++){
if(a[j]<a[k])j=i;
else j++;
if(!ans[k])ans[k]=i;
}
for(int len=k-j;i<=j;i+=len);
if(!ans[k])ans[k]=i;
}
for(int i=1;i<=n;i++)printf("%d %d\n",ans[i],i);
return 0;
}
详细
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 5584kb
input:
potato
output:
1 1 1 2 3 3 3 4 5 5 5 6
result:
wrong answer 9th words differ - expected: '3', found: '5'