Submission #62777093
Source Code Expand
Copy
#include <bits/stdc++.h>#include <ext/pb_ds/assoc_container.hpp>#include <ext/pb_ds/tree_policy.hpp>#define int long long#define fn for (int i = 0; i < n; i++)#define f(i, a, n) for (int i = a; i < n; i++)#define all(v) v.begin(), v.end()const int MOD = 1e9 + 7;#define sort(a) sort(a.begin(), a.end())#define vi vector<int> v#define vvi vector<vector<int>>#define vpi vector<pair<int, int>>#define p(ans) cout << ans << endl;#define yes cout << 'Y' << 'E' << 'S' << endl;#define no cout << 'N' << 'O' << endl;#define inp(v) \int x; \cin >> x; \v.push_back(x)using namespace std;using namespace __gnu_pbds;
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #define int long long #define fn for (int i = 0; i < n; i++) #define f(i, a, n) for (int i = a; i < n; i++) #define all(v) v.begin(), v.end() const int MOD = 1e9 + 7; #define sort(a) sort(a.begin(), a.end()) #define vi vector<int> v #define vvi vector<vector<int>> #define vpi vector<pair<int, int>> #define p(ans) cout << ans << endl; #define yes cout << 'Y' << 'E' << 'S' << endl; #define no cout << 'N' << 'O' << endl; #define inp(v) \ int x; \ cin >> x; \ v.push_back(x) using namespace std; using namespace __gnu_pbds; typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds; // find_by_order, order_of_key less-> increasing order greater->dreasing order // *A.find_order_of(index)-> give element at that index // A.order_of_key(x)->gives no of ele less than x (unique ele present) in case of inc set A.lower_bound(ele)->gives iterator of lb class dsu { public: vector<int> rank, parent, size; dsu(int n) { rank.resize(n + 1, 0); parent.resize(n + 1); size.resize(n + 1, 1); for (int i = 0; i <= n; i++) parent[i] = i; } int find(int node) { if (node == parent[node]) return node; return parent[node] = find(parent[node]); } void unionbysize(int u, int v) { int p1 = find(u); int p2 = find(v); if (p1 == p2) return; if (size[p1] < size[p2]) { parent[p1] = p2; size[p2] += size[p1]; } else { parent[p2] = p1; size[p1] += size[p2]; } } void unionbyrank(int u, int v) { int p1 = find(u); int p2 = find(v); if (p1 == p2) return; if (rank[p1] < rank[p2]) { parent[p1] = p2; } else if (rank[p1] > rank[p2]) parent[p2] = p1; else { parent[p1] = p2; rank[p2]++; } } }; bool p_check(int n) { for (int i = 2; i * i <= n; i++) { if (n % i == 0) { return false; } } return true; } int modExp(int base, int exp, int mod) { int result = 1; base = base % mod; while (exp > 0) { if (exp % 2 == 1) { result = (result * base) % mod; } base = (base * base) % mod; exp /= 2; } return result; } int modInverse(int Q, int mod) { return modExp(Q, mod - 2, mod); } int power(int a, int b) { if (b == 0) return 1; else if (b == 1) return a; int ans = power(a, b / 2); if (b % 2 == 0) return ans * ans; else return ans * ans * a; } int gcd(int a, int b) { if (a % b == 0) return b; return gcd(b, a % b); } int lcm(int a, int b) { int ans = (a * b) / (gcd(a, b)); return ans; } int quary(string &s) { cout << '?' << s << endl; cout.flush(); int t; cin >> t; return t; } int32_t main() { ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); string str; cin >> str; int n = str.length(); int ct = 0; fn { for (int j = i + 1; j < n; j++) { for (int k = j + 1; k < n; k++) { if (k - j == j - i && str[i] == 'A' && str[j] == 'B' && str[k] == 'C') { ct++; } } } } cout << ct << endl; }
Submission Info
Submission Time | |
---|---|
Task | B - A..B..C |
User | rishabh_638413 |
Language | C++ 20 (gcc 12.2) |
Score | 200 |
Code Size | 3772 Byte |
Status | AC |
Exec Time | 1 ms |
Memory | 3596 KB |
Judge Result
Set Name | Sample | All | ||||
---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 200 / 200 | ||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt |
All | 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt, 01_random_00.txt, 01_random_01.txt, 01_random_02.txt, 01_random_03.txt, 01_random_04.txt, 01_random_05.txt, 01_random_06.txt, 01_random_07.txt, 01_random_08.txt, 01_random_09.txt, 01_random_10.txt, 02_random2_00.txt, 02_random2_01.txt, 02_random2_02.txt, 02_random2_03.txt, 03_handmade_00.txt, 03_handmade_01.txt, 03_handmade_02.txt, 03_handmade_03.txt, 03_handmade_04.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
00_sample_00.txt | AC | 1 ms | 3392 KB |
00_sample_01.txt | AC | 1 ms | 3504 KB |
00_sample_02.txt | AC | 1 ms | 3476 KB |
01_random_00.txt | AC | 1 ms | 3484 KB |
01_random_01.txt | AC | 1 ms | 3480 KB |
01_random_02.txt | AC | 1 ms | 3460 KB |
01_random_03.txt | AC | 1 ms | 3440 KB |
01_random_04.txt | AC | 1 ms | 3316 KB |
01_random_05.txt | AC | 1 ms | 3480 KB |
01_random_06.txt | AC | 1 ms | 3392 KB |
01_random_07.txt | AC | 1 ms | 3480 KB |
01_random_08.txt | AC | 1 ms | 3440 KB |
01_random_09.txt | AC | 1 ms | 3440 KB |
01_random_10.txt | AC | 1 ms | 3412 KB |
02_random2_00.txt | AC | 1 ms | 3460 KB |
02_random2_01.txt | AC | 1 ms | 3412 KB |
02_random2_02.txt | AC | 1 ms | 3456 KB |
02_random2_03.txt | AC | 1 ms | 3412 KB |
03_handmade_00.txt | AC | 1 ms | 3596 KB |
03_handmade_01.txt | AC | 1 ms | 3592 KB |
03_handmade_02.txt | AC | 1 ms | 3384 KB |
03_handmade_03.txt | AC | 1 ms | 3516 KB |
03_handmade_04.txt | AC | 1 ms | 3464 KB |