QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#113685 | #5501. Ctrl+C Ctrl+V | Sa3tElSefr | AC ✓ | 49ms | 19092kb | C++23 | 2.1kb | 2023-06-19 03:54:37 | 2023-06-19 03:54:40 |
Judging History
answer
/// Till I Collapse
/*
* Hypothesis:
*
* Proof:
*
* Time Complexity:
*
* Memory Complexity:
*
*/
#pragma GCC optimize("O3")
#pragma GCC optimize ("unroll-loops")
#pragma GCC target("avx,avx2,fma")
#include "bits/stdc++.h"
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
using namespace std;
using namespace __gnu_pbds;
#define pb push_back
#define F first
#define S second
#define f(i, a, b) for(int i = a; i < b; i++)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define sz(x) (int)(x).size()
#define mp(x, y) make_pair(x,y)
#define popCnt(x) (__builtin_popcountll(x))
#define int ll
using ll = long long;
using ii = pair<int, int>;
using ull = unsigned long long;
const int N = 2e5 + 5, LG = 19, MOD = (119 << 23) + 1;
const long double PI = acos(-1);
const long double EPS = 1e-7;
mt19937_64 mrand(chrono::steady_clock::now().time_since_epoch().count());
const int dx[] = {-1, 1, -1, 1};
const int dy[] = {1, -1, -1, 1};
vector<int> adj[N], radj[N];
int lvl[N];
bool vis[N];
vector<int> ord;
vector<int> topo;
void dfs(int node) {
if (vis[node])
return;
vis[node] = true;
for (auto v: radj[node])
dfs(v);
topo.push_back(node);
}
int g;
vector<int> vec;
int cnt[N];
int scc[N];
int cmp;
void dfs2(int node, int d) {
if (lvl[node]) {
g = __gcd(g, abs(lvl[node] - d));
return;
}
scc[node] = cmp;
vec.push_back(node);
lvl[node] = d;
for (auto v: adj[node])
if (!lvl[v] || scc[v] == scc[node])
dfs2(v, d + 1);
}
void doWork() {
string s;
cin >> s;
int ans = 0;
f(i, 3, s.size()) {
if (s.substr(i - 3, 4) == "ania") {
s[i] = 'x';
ans += 1;
}
}
cout << ans << '\n';
}
int32_t main() {
#ifdef ONLINE_JUDGE
ios_base::sync_with_stdio(0);
cin.tie(0);
#endif // ONLINE_JUDGE
int t = 1;
cin >> t;
while (t--) {
doWork();
}
return 0;
}
詳細信息
Test #1:
score: 100
Accepted
time: 2ms
memory: 16276kb
input:
3 aniasieurodzilaapotemnicsieniedzialo nicciekawegouanianiagnieszkianialicji jeszczekrotszaautobiografiaani
output:
1 2 0
result:
ok 3 lines
Test #2:
score: 0
Accepted
time: 22ms
memory: 14884kb
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: 49ms
memory: 16316kb
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: 44ms
memory: 19092kb
input:
5 aanninaiiiiiaaaaaiiniaaiaaanniiaaaiiiainainananinannnaiaiiainnianaainaaiaanannnnnniaiaiainanaaniaaaainaaanaanianiininiaiiaaaaaainaniinaininniiiinaaaannnananniianaananiainiiiniinninnnainaiiiaanaananinaininiiaaanaiiininnanannannnnaiaaaniiaaniaaanaaaiinianniaiiaiinaannaanniiaininaiianaiiiniinaaiiania...
output:
15253 17190 166607 49472 166658
result:
ok 5 lines