QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#76857 | #5501. Ctrl+C Ctrl+V | rniya | AC ✓ | 30ms | 6196kb | C++17 | 2.6kb | 2023-02-12 13:37:09 | 2023-02-12 13:37:11 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define ALL(x) (x).begin(), (x).end()
#ifdef LOCAL
#include "debug.hpp"
#else
#define debug(...) void(0)
#endif
template <typename T> istream& operator>>(istream& is, vector<T>& v) {
for (T& x : v) is >> x;
return is;
}
template <typename T> ostream& operator<<(ostream& os, const vector<T>& v) {
for (size_t i = 0; i < v.size(); i++) {
os << v[i] << (i + 1 == v.size() ? "" : " ");
}
return os;
}
template <typename T> T gcd(T x, T y) { return y != 0 ? gcd(y, x % y) : x; }
template <typename T> T lcm(T x, T y) { return x / gcd(x, y) * y; }
int topbit(signed t) { return t == 0 ? -1 : 31 - __builtin_clz(t); }
int topbit(long long t) { return t == 0 ? -1 : 63 - __builtin_clzll(t); }
int botbit(signed a) { return a == 0 ? 32 : __builtin_ctz(a); }
int botbit(long long a) { return a == 0 ? 64 : __builtin_ctzll(a); }
int popcount(signed t) { return __builtin_popcount(t); }
int popcount(long long t) { return __builtin_popcountll(t); }
bool ispow2(int i) { return i && (i & -i) == i; }
long long MSK(int n) { return (1LL << n) - 1; }
template <class T> T ceil(T x, T y) {
assert(y >= 1);
return (x > 0 ? (x + y - 1) / y : x / y);
}
template <class T> T floor(T x, T y) {
assert(y >= 1);
return (x > 0 ? x / y : (x - y + 1) / y);
}
template <class T1, class T2> inline bool chmin(T1& a, T2 b) {
if (a > b) {
a = b;
return true;
}
return false;
}
template <class T1, class T2> inline bool chmax(T1& a, T2 b) {
if (a < b) {
a = b;
return true;
}
return false;
}
template <typename T> void mkuni(vector<T>& v) {
sort(v.begin(), v.end());
v.erase(unique(v.begin(), v.end()), v.end());
}
template <typename T> int lwb(const vector<T>& v, const T& x) { return lower_bound(v.begin(), v.end(), x) - v.begin(); }
const int INF = (1 << 30) - 1;
const long long IINF = (1LL << 60) - 1;
const int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
const int MOD = 998244353;
// const int MOD = 1000000007;
const string target = "ania";
void solve() {
string S;
cin >> S;
int ans = 0, n = S.size();
for (int i = 0, cur = 0; i < n; i++) {
if (S[i] == target[cur])
cur++;
else if (S[i] == target[0])
cur = 1;
else
cur = 0;
if (cur == 4) ans++, cur = 0;
}
cout << ans << '\n';
}
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
int z;
cin >> z;
for (; z--;) solve();
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 2ms
memory: 3352kb
input:
3 aniasieurodzilaapotemnicsieniedzialo nicciekawegouanianiagnieszkianialicji jeszczekrotszaautobiografiaani
output:
1 2 0
result:
ok 3 lines
Test #2:
score: 0
Accepted
time: 15ms
memory: 3384kb
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: 30ms
memory: 3496kb
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: 15ms
memory: 6196kb
input:
5 aanninaiiiiiaaaaaiiniaaiaaanniiaaaiiiainainananinannnaiaiiainnianaainaaiaanannnnnniaiaiainanaaniaaaainaaanaanianiininiaiiaaaaaainaniinaininniiiinaaaannnananniianaananiainiiiniinninnnainaiiiaanaananinaininiiaaanaiiininnanannannnnaiaaaniiaaniaaanaaaiinianniaiiaiinaannaanniiaininaiianaiiiniinaaiiania...
output:
15253 17190 166607 49472 166658
result:
ok 5 lines