编号 题目 状态 分数 总时间 内存 代码 / 答案文件 提交者 提交时间
#16143 #1065. 被优化掉的Shenchuan Accepted 100 105 ms 1568 K C++ / 779 B 192022211886 2024-03-16 14:55:19
显示原始代码
#include <iostream>
#include <vector>
#include <cstring>
//#include <bits\stdc++.h>
using namespace std;
// shenchuanlzhshenchuan
int main() {
    char s1[10] = "shenchuan";
    int n, len = 0;
    cin >> n;
    char s2[n];
    for (int i = 0; i < n; i++) {
        cin >> s2[i];
    }

    vector<int> arr;
    int cnt = 0;
    for (int i = 0; i < n;) {
        len = 0;
        int k = i;
        for (int j = 0; j < 9; j++, i++) {
            if (s2[i] == s1[j]) {
                len++;
            } else {
                break;
            }
        }
        i = k;
        //		cout<<len<<endl;
        if (len == 9) {
            arr.push_back(k);
            cnt++;
        }
        //		cout<<cnt<<endl;

        if (len == 0) {
            i++;
        } else {
            i += len;
        }
    }

    cout << cnt << endl;
    for (int i = 0; i < arr.size(); i++) {
        if (i == 0) {
            cout << arr[i];
        } else {
            cout << " " << arr[i];
        }
    }
    return 0;
}
子任务 #1
Accepted
得分:100
测试点 #1
Accepted
得分:100
用时:4 ms
内存:388 KiB

输入文件(1.in

7542
ibmvpqolwmyepkgsreliijtpnpvuyqdjgxhtfpttishenchuanyyclupkqpnrajhfqfmgahayaitshenchuanhdshenchu
<7448 bytes omitted>

答案文件(1.out

200
41 76 87 140 172 182 222 312 347 416 440 481 502 519 532 582 601 658 717 744 804 834 863 936 96
<877 bytes omitted>

用户输出

200
41 76 87 140 172 182 222 312 347 416 440 481 502 519 532 582 601 658 717 744 804 834 863 936 967 1025 1041 1056 1084 1121 11
<847 bytes omitted>

系统信息

Exited with return code 0
测试点 #2
Accepted
得分:100
用时:6 ms
内存:284 KiB

输入文件(2.in

7561
vdtldccehtcsshenchuanirqbgwtctndsbdxmbdpkumyshenchuaniiummbmovshenchuanlqhnqeowfxgjtmshenchuan
<7467 bytes omitted>

答案文件(2.out

196
12 44 62 85 100 133 172 189 209 229 295 346 387 401 423 439 455 483 496 589 609 682 717 813 937
<856 bytes omitted>

用户输出

196
12 44 62 85 100 133 172 189 209 229 295 346 387 401 423 439 455 483 496 589 609 682 717 813 937 1031 1100 1124 1160 1171 121
<826 bytes omitted>

系统信息

Exited with return code 0
测试点 #3
Accepted
得分:100
用时:58 ms
内存:1568 KiB

输入文件(3.in

1000000
shenchuanxdufyijxqtgcxgilcytaiapshenchuanixnxkwpyvrjshenchuanjnvxrwkfutwwqyrrqcroucnoshench
<999909 bytes omitted>

答案文件(3.out

26432
0 32 52 85 141 165 191 203 330 369 381 406 449 464 479 511 543 556 570 590 613 659 684 800 82
<181976 bytes omitted>

用户输出

26432
0 32 52 85 141 165 191 203 330 369 381 406 449 464 479 511 543 556 570 590 613 659 684 800 823 835 860 901 952 1026 1051 1
<181946 bytes omitted>

系统信息

Exited with return code 0
测试点 #4
Accepted
得分:100
用时:11 ms
内存:524 KiB

输入文件(4.in

107616
arnvopvilashenchuanuhairrqcnvipslaysruwpvovxkmshenchuaniwjyfkklcixbdomgmolqdwpcqnxshenchuand
<107524 bytes omitted>

答案文件(4.out

2889
10 46 82 105 160 187 211 257 282 319 347 356 376 463 532 582 592 659 695 814 830 889 924 994 1
<17184 bytes omitted>

用户输出

2889
10 46 82 105 160 187 211 257 282 319 347 356 376 463 532 582 592 659 695 814 830 889 924 994 1042 1067 1106 1143 1161 1182 
<17154 bytes omitted>

系统信息

Exited with return code 0
测试点 #5
Accepted
得分:100
用时:9 ms
内存:520 KiB

输入文件(5.in

107635
gmtmbbcbuhugvtxctjfaxhwyehwurkvwjbhrxfjpvsmuqhytyshkyipvyarhtqnctjaldxfqwimnnbopnshenchuansh
<107543 bytes omitted>

答案文件(5.out

2914
81 90 113 132 160 248 337 393 436 454 539 616 628 687 700 723 749 795 829 864 897 908 927 938 
<17304 bytes omitted>

用户输出

2914
81 90 113 132 160 248 337 393 436 454 539 616 628 687 700 723 749 795 829 864 897 908 927 938 994 1148 1192 1205 1244 1266 
<17274 bytes omitted>

系统信息

Exited with return code 0
测试点 #6
Accepted
得分:100
用时:5 ms
内存:296 KiB

输入文件(6.in

7
wumnhfo

答案文件(6.out

0

用户输出

0

系统信息

Exited with return code 0
测试点 #7
Accepted
得分:100
用时:4 ms
内存:344 KiB

输入文件(7.in

10
pjsusnkior

答案文件(7.out

0

用户输出

0

系统信息

Exited with return code 0
测试点 #8
Accepted
得分:100
用时:4 ms
内存:284 KiB

输入文件(8.in

7
shenchua

答案文件(8.out

0

用户输出

0

系统信息

Exited with return code 0
测试点 #9
Accepted
得分:100
用时:4 ms
内存:324 KiB

输入文件(9.in

17
shenchuashenchuan

答案文件(9.out

1
8

用户输出

1
8

系统信息

Exited with return code 0