QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#239750 | #5501. Ctrl+C Ctrl+V | elkernos# | WA | 7ms | 3632kb | C++23 | 1.8kb | 2023-11-04 22:58:42 | 2023-11-04 22:58:45 |
Judging History
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 = 1;
} else {
ptr++;
}
}
debug(i, j, ile);
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: 3584kb
input:
3 aniasieurodzilaapotemnicsieniedzialo nicciekawegouanianiagnieszkianialicji jeszczekrotszaautobiografiaani
output:
1 2 0
result:
ok 3 lines
Test #2:
score: -100
Wrong Answer
time: 7ms
memory: 3632kb
input:
10000 aniaanianianianiaviananibnianianianianianiapianianianianianianiaanianianianiananianianianiananifw ananiacnganiaaywbwrkaniahaniaganiaglljaniaouaqrdyaniaypvsgjltrbcvjssrtnehqfzpfvaniahwaniauzncovwfmiqejteiuaniacblxyfikauptesitsitvananianiajndy anianianianianianiaanianianianianiaanianianianianiaa...
output:
13 10 42 16 4 11 27 1 21 3 12 12 44 6 67 29 49 55 14 10 17 14 11 6 59 3 15 10 41 58 11 19 7 3 18 25 8 59 11 24 48 16 3 9 21 58 3 17 25 17 18 11 24 1 20 1 16 11 60 40 16 7 2 5 18 16 68 1 56 48 5 12 44 8 5 13 60 14 13 11 11 4 61 15 22 8 15 66 7 22 59 8 39 14 18 18 8 47 49 11 1 8 7 4 25 62 0 25 10 13 3...
result:
wrong answer 2nd lines differ - expected: '11', found: '10'