QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#239742#5501. Ctrl+C Ctrl+Velkernos#WA 11ms3640kbC++231.7kb2023-11-04 22:56:022023-11-04 22:56:02

Judging History

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

  • [2023-11-04 22:56:02]
  • 评测
  • 测评结果:WA
  • 用时:11ms
  • 内存:3640kb
  • [2023-11-04 22:56:02]
  • 提交

answer

//Sylwia Sapkowska
#include <bits/stdc++.h>
#pragma GCC optimize("O3", "unroll-loops")
using namespace std;

void __print(int x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << "'" << x << "'";}
void __print(const char *x) {cerr << '"' << x << '"';}
void __print(const string &x) {cerr << '"' << x << '"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ", "; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? ", " : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifdef LOCAL
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif

#define int long long
typedef pair<int, int> T;
const int oo = 1e18, oo2 = 1e9+7, K = 30;
const int mod = 998244353;

void solve(){
    string s; cin >> s;
    int n = (int)s.size();
    string t = "ania";
    int j = 0;
    int ans = 0;
    for (int i = 0; i<n; i=j+1){
        j = i;
        int ptr = 0, ile = 0;
        while (j < n && s[j] == t[ptr]){
            j++;
            if (ptr == 3){
                ile++;
                ptr = 0;
            } else {
                ptr++;
            }
        }
        ans += (ile+1)/2;
    }
    cout << ans << "\n";
}

int32_t main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    int t = 1;
    cin >> t;
    while (t--) solve();

    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 3480kb

input:

3
aniasieurodzilaapotemnicsieniedzialo
nicciekawegouanianiagnieszkianialicji
jeszczekrotszaautobiografiaani

output:

1
2
0

result:

ok 3 lines

Test #2:

score: -100
Wrong Answer
time: 11ms
memory: 3640kb

input:

10000
aniaanianianianiaviananibnianianianianianiapianianianianianianiaanianianianiananianianianiananifw
ananiacnganiaaywbwrkaniahaniaganiaglljaniaouaqrdyaniaypvsgjltrbcvjssrtnehqfzpfvaniahwaniauzncovwfmiqejteiuaniacblxyfikauptesitsitvananianiajndy
anianianianianianiaanianianianianiaanianianianianiaa...

output:

12
10
42
16
4
11
27
1
25
4
12
12
42
6
66
31
47
55
13
10
17
14
10
7
60
3
16
9
39
55
11
18
7
3
17
20
8
59
12
24
48
15
3
7
21
62
3
17
25
17
18
11
24
2
20
1
15
12
60
40
15
7
2
5
17
16
65
1
56
45
6
11
42
8
4
16
61
15
14
11
11
4
61
14
22
7
15
71
7
21
58
7
40
14
18
18
8
46
49
11
1
8
7
4
25
64
0
24
10
13
32...

result:

wrong answer 1st lines differ - expected: '13', found: '12'