QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#500802#5501. Ctrl+C Ctrl+VSakib_SafwanAC ✓17ms6372kbC++202.7kb2024-08-01 20:51:402024-08-01 20:51:40

Judging History

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

  • [2024-08-01 20:51:40]
  • 评测
  • 测评结果:AC
  • 用时:17ms
  • 内存:6372kb
  • [2024-08-01 20:51:40]
  • 提交

answer

#include<bits/stdc++.h>

using namespace std;


typedef long long ll;
typedef long double ld;

#define endl "\n"
#define all(a) a.begin(), a.end()
#define pb push_back
#define eb emplace_back
// #define int long long



// Don't Start typing till you complete the idea.


// Check these things for WA and before submitting
// 1. Did you clear all the global arrays
// 2. Did you checked your <= >= < > 
// 3. Did you take the input properly. Did you use break or return while taking input?
// 4. Did you divide by 0.
// 5. Check array , vector , etc size
// 6. in the while loop did you miss something that would cause infinite loop?
// 7. Did you save your dp?
// 8. Are you trying to use something after deleting it?
// 9. Did you read the problem statement wrong?
// 10. Did you check the constrains of the problem properly
// 11. Did you checked for smaller cases like 1 , 0 , etc
// 12. Is it something to with overflow?
// 13. Did you initialized all the variables properly?
// 14. Did you use the formulas correctly?

// STRESS TESTING !!!!!! STRESS TESTING !!!!!
// STRESS Testing Not working?
// Stress test for multiple cases? 
// Stress test for big inputs?
// Stress test for really small inputs?
// Even then if it doesn't work -> Did you wrote the wrong Brute force code


// Check these things if you are not generating ideas
// 1. Did you try thinking it in reverse?
// 2. Read the problem statement again
// 3. Check the constraints again
// 4. Try smaller cases in notebook and try to expand
// 5. Think about invariants
// 6. Think simpler ideas maybe?
// 7. Think brute force and try to get something out of it.
// 8. Maybe take a deep breath and take a break for few minutes and drink some water? :3 

template <class T>
struct BIT { //1-indexed
  int n; vector<T> t;
  BIT() {}
  BIT(int _n) {
    n = _n; t.assign(n + 1, 0);
  }
  T query(int i) {
    T ans = 0;
    for (; i >= 1; i -= (i & -i)) ans += t[i];
    return ans;
  }
  void upd(int i, T val) {
    if (i <= 0) return;
    for (; i <= n; i += (i & -i)) t[i] += val;
  }
  void upd(int l, int r, T val) {
    upd(l, val);
    upd(r + 1, -val);
  }
  T query(int l, int r) {
    return query(r) - query(l - 1);
  }
};

void GG()
{
  int n;
  // cin >> n;
  string s;
  cin >> s;
  n = s.size();
  int cnt = 0;
  for(int i = 3; i < n; i++){
    if(s[i - 3] == 'a' && s[i - 2] == 'n' && s[i - 1] == 'i' && s[i] == 'a') cnt++ , s[i] = 'z'; 
  }
  cout << cnt << endl;
}

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

	int ttc=1;
	cin>>ttc;
	//int cnt=0;
	while(ttc--)
	{
		//cout<<"Case "<<++cnt<<": ";
		GG();
	}
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

3
aniasieurodzilaapotemnicsieniedzialo
nicciekawegouanianiagnieszkianialicji
jeszczekrotszaautobiografiaani

output:

1
2
0

result:

ok 3 lines

Test #2:

score: 0
Accepted
time: 9ms
memory: 3576kb

input:

10000
aniaanianianianiaviananibnianianianianianiapianianianianianianiaanianianianiananianianianiananifw
ananiacnganiaaywbwrkaniahaniaganiaglljaniaouaqrdyaniaypvsgjltrbcvjssrtnehqfzpfvaniahwaniauzncovwfmiqejteiuaniacblxyfikauptesitsitvananianiajndy
anianianianianianiaanianianianianiaanianianianianiaa...

output:

13
11
53
16
10
13
35
2
39
7
19
14
47
7
78
34
59
60
21
13
22
18
18
9
77
3
19
14
44
64
18
26
14
4
27
38
9
65
13
27
51
23
3
13
26
69
5
20
32
23
22
13
29
2
23
2
18
21
68
50
21
9
5
6
21
22
77
1
60
54
8
19
51
13
6
18
70
18
22
19
20
4
74
17
26
8
19
78
11
28
72
8
45
21
23
21
15
54
65
14
2
9
10
5
33
78
0
30
...

result:

ok 10000 lines

Test #3:

score: 0
Accepted
time: 14ms
memory: 3896kb

input:

335
ananianianianianianianianianianianianianianianianianianianianianianianianianianiaanianianianianianianianianianianianianianianianianianianianianianianianianianianianianianianianianianianianianianiananianianianianianianianiananianianianianianianianianianianianianianianianianianianianianianianiania...

output:

3075
476
650
443
510
2446
624
560
2256
679
3138
361
512
300
484
1726
659
559
1887
381
3048
700
507
2769
2688
615
706
631
3009
367
516
535
3150
1759
418
489
1738
2676
497
666
655
2391
547
405
677
2189
492
465
413
2008
2477
2125
2586
1788
439
2765
2781
667
279
294
523
654
414
2126
2156
2175
1855
3135
...

result:

ok 335 lines

Test #4:

score: 0
Accepted
time: 17ms
memory: 6372kb

input:

5
aanninaiiiiiaaaaaiiniaaiaaanniiaaaiiiainainananinannnaiaiiainnianaainaaiaanannnnnniaiaiainanaaniaaaainaaanaanianiininiaiiaaaaaainaniinaininniiiinaaaannnananniianaananiainiiiniinninnnainaiiiaanaananinaininiiaaanaiiininnanannannnnaiaaaniiaaniaaanaaaiinianniaiiaiinaannaanniiaininaiianaiiiniinaaiiania...

output:

15253
17190
166607
49472
166658

result:

ok 5 lines