Submission #1694777
Source Code Expand
#include <bits/stdc++.h> using namespace std; #define INF 1001000100010001000 #define MOD 1000000007 #define EPS 1e-10 #define int long long #define rep(i, N) for (int i = 0; i < N; i++) #define Rep(i, N) for (int i = 1; i < N; i++) #define For(i, a, b) for (int i = (a); i < (b); i++) #define pb push_back #define eb emplece_back #define mp make_pair #define i_i pair<int, int> #define vi vector<int> #define vvi vector<vi > #define vb vector<bool> #define vvb vector<vb > #define vp vector< i_i > #define all(a) (a).begin(), (a).end() #define Int(x) int x; cin >> x; #define int2(x, y) Int(x); Int(y); #define int3(x, y, z) Int(x); int2(y, z); #define fir first #define sec second #define ffir first.first #define fsec first.second #define sfir second.first #define ssec second.second //int dxy[5] = {0, 1, 0, -1, 0}; // assign avl ncm dijkstra geo2 kruskal graph uf lca BIT // matrix dinic next_combination topcoder lcm signed main() { std::ios::sync_with_stdio(false); std::cin.tie(0); string s; cin >> s; int n = s.size(); vvi table(s.size()+1, vi(26, 0)); for (int i = n-1; i >= 0; i--) { for (int j = 0; j < 26; j++) { table[i][j] = table[i+1][j]; } table[i][s[i]-'a']++; } int ans = 0; rep(i, n) { rep(j, 26) { if (s[i] - 'a' != j) { ans += table[i][j]; } } } cout << ans + 1 << endl; return 0; }
Submission Info
Submission Time | |
---|---|
Task | B - Reverse and Compare |
User | Ti11192916 |
Language | C++14 (GCC 5.4.1) |
Score | 500 |
Code Size | 1529 Byte |
Status | AC |
Exec Time | 53 ms |
Memory | 48916 KB |
Judge Result
Set Name | Sample | All | ||||
---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 500 / 500 | ||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | sample_01.txt, sample_02.txt, sample_03.txt |
All | sample_01.txt, sample_02.txt, sample_03.txt, sample_01.txt, sample_02.txt, sample_03.txt, subtask_1_01.txt, subtask_1_02.txt, subtask_1_03.txt, subtask_1_04.txt, subtask_1_05.txt, subtask_1_06.txt, subtask_1_07.txt, subtask_1_08.txt, subtask_1_09.txt, subtask_1_10.txt, subtask_1_11.txt, subtask_1_12.txt, subtask_1_13.txt, subtask_1_14.txt, subtask_1_15.txt, subtask_1_16.txt, subtask_1_17.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
sample_01.txt | AC | 1 ms | 256 KB |
sample_02.txt | AC | 1 ms | 256 KB |
sample_03.txt | AC | 1 ms | 256 KB |
subtask_1_01.txt | AC | 1 ms | 256 KB |
subtask_1_02.txt | AC | 52 ms | 48916 KB |
subtask_1_03.txt | AC | 1 ms | 256 KB |
subtask_1_04.txt | AC | 1 ms | 256 KB |
subtask_1_05.txt | AC | 1 ms | 256 KB |
subtask_1_06.txt | AC | 2 ms | 768 KB |
subtask_1_07.txt | AC | 5 ms | 4608 KB |
subtask_1_08.txt | AC | 53 ms | 48916 KB |
subtask_1_09.txt | AC | 51 ms | 48916 KB |
subtask_1_10.txt | AC | 52 ms | 48916 KB |
subtask_1_11.txt | AC | 52 ms | 48916 KB |
subtask_1_12.txt | AC | 51 ms | 48916 KB |
subtask_1_13.txt | AC | 51 ms | 48916 KB |
subtask_1_14.txt | AC | 50 ms | 48916 KB |
subtask_1_15.txt | AC | 50 ms | 48916 KB |
subtask_1_16.txt | AC | 51 ms | 48916 KB |
subtask_1_17.txt | AC | 51 ms | 48916 KB |