QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#302688#6624. String Problemucup-team1004WA 0ms5584kbC++14940b2024-01-11 07:12:352024-01-11 07:12:35

Judging History

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

  • [2024-01-11 07:12:35]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:5584kb
  • [2024-01-11 07:12:35]
  • 提交

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;
}

Details

Tip: Click on the bar to expand more detailed information

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'