QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#302687 | #6624. String Problem | ucup-team1004 | WA | 1ms | 5944kb | C++14 | 952b | 2024-01-11 07:11:21 | 2024-01-11 07:11:21 |
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;){
debug(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;
}
ans[1]=1;
for(int i=1;i<=n;i++)printf("%d %d\n",ans[i],i);
return 0;
}
詳細信息
Test #1:
score: 100
Accepted
time: 1ms
memory: 5944kb
input:
potato
output:
1 1 1 2 3 3 3 4 3 5 5 6
result:
ok 12 tokens
Test #2:
score: 0
Accepted
time: 1ms
memory: 5900kb
input:
pbpbppb
output:
1 1 1 2 1 3 1 4 1 5 5 6 5 7
result:
ok 14 tokens
Test #3:
score: 0
Accepted
time: 1ms
memory: 5860kb
input:
dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd...
output:
1 1 1 2 1 3 1 4 1 5 1 6 1 7 1 8 1 9 1 10 1 11 1 12 1 13 1 14 1 15 1 16 1 17 1 18 1 19 1 20 1 21 1 22 1 23 1 24 1 25 1 26 1 27 1 28 1 29 1 30 1 31 1 32 1 33 1 34 1 35 1 36 1 37 1 38 1 39 1 40 1 41 1 42 1 43 1 44 1 45 1 46 1 47 1 48 1 49 1 50 1 51 1 52 1 53 1 54 1 55 1 56 1 57 1 58 1 59 1 60 1 61 1 62...
result:
ok 1990 tokens
Test #4:
score: 0
Accepted
time: 1ms
memory: 5884kb
input:
gtgggtgttgggggtgtgggtgttggtttggggtggtgtgggttggtggggtgggttgttggttgggtttggggtgttgggggtgggttttggttgttggtggggttgttggtggtggggtgggttttgggttggtgggtgggtggttgtgttggttttttttgttgggtttgggtgttgttgtggtgggttttggttggggtgttggttggtgtggtgtgggttttggttttttgtttgtggtggtgttttgtttttggtggggtgtttgttgttttggggttggggtgggggttgtgg...
output:
1 1 2 2 2 3 2 4 2 5 2 6 2 7 6 8 8 9 8 10 8 11 8 12 8 13 8 14 8 15 8 16 8 17 8 18 8 19 8 20 8 21 8 22 8 23 8 24 8 25 8 26 23 27 23 28 27 29 27 30 27 31 27 32 27 33 27 34 27 35 27 36 27 37 27 38 27 39 27 40 27 41 27 42 27 43 27 44 27 45 27 46 27 47 27 48 27 49 27 50 27 51 27 52 27 53 27 54 27 55 27 56...
result:
ok 1994 tokens
Test #5:
score: 0
Accepted
time: 1ms
memory: 5852kb
input:
uuppuppuspusupspsuspsusssuupspppuuuusupspsssssusppsppsppsppsupuuupsssussupspsupsusssppsuuppspsuuspuppssppssusuussuuuupsspupssupuuppppsspuuspsupsususussupuppuuusspsuupppspspuupuppuuspssususpsususpsspsspssuuupuppppsupusupppsppspsuuusspupuspuspsusspsuspuspssuupuupsssupupppspppupsuspusppssusspspsuuuspsp...
output:
1 1 1 2 1 3 1 4 1 5 1 6 1 7 1 8 1 9 1 10 1 11 1 12 1 13 1 14 1 15 1 16 1 17 1 18 1 19 1 20 1 21 1 22 1 23 1 24 1 25 1 26 1 27 1 28 26 29 26 30 26 31 26 32 26 33 26 34 33 35 33 36 33 37 33 38 33 39 33 40 33 41 33 42 33 43 33 44 33 45 33 46 33 47 33 48 33 49 33 50 33 51 33 52 33 53 33 54 33 55 33 56 3...
result:
ok 1998 tokens
Test #6:
score: -100
Wrong Answer
time: 1ms
memory: 5944kb
input:
vqvvsvvvvqssssvxvxsvxvsvxxqsqxqvvxvqqsvvsqvvssqqxvxvqqxqxvqqsxvsqxqvvxxvsxvxxssssvqvvsxvqvvxxxsqxvxxsqssxvvxvsxsvsvvvxsxvsvsqvvvqsssvvvqxssqqqxvqqvsqqqsxqqxvvsqxqqvsxqqqqvqxxqvqvqqqvsvsvxsvssvqvqxsqqvxvqqqvqsssqxsvqvsqqxqqqqxsxxxsvsqqqxvssssxssqxsxxvxqxvqsxxxqxssxxvsxxxqqvsqxsxxxxqxvsqsvsqsqssvsxqsv...
output:
1 1 1 2 1 3 3 4 3 5 3 6 3 7 6 8 6 9 6 10 6 11 6 12 6 13 6 14 6 15 15 16 16 17 16 18 16 19 16 20 16 21 16 22 16 23 16 24 16 25 25 26 25 27 25 28 25 29 25 30 25 31 25 32 25 33 25 34 25 35 25 36 25 37 25 38 25 39 25 40 25 41 25 42 25 43 25 44 25 45 25 46 25 47 25 48 25 49 25 50 25 51 25 52 25 53 25 54 ...
result:
wrong answer 31st words differ - expected: '16', found: '15'