QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#847153 | #5737. Remorse | Teapot# | AC ✓ | 1ms | 3872kb | C++20 | 1.6kb | 2025-01-07 18:07:09 | 2025-01-07 18:07:09 |
Judging History
answer
/** gnu specific **/
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
/** contains everything I need in std **/
#include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(S) ((int)S.size())
#define FOR(i, st_, n) for(int i = st_; i < n; ++i)
#define RFOR(i, n, end_) for(int i = (n)-1; i >= end_; --i)
#define x first
#define y second
#define pb push_back
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> pll;
typedef pair<int, int> pii;
typedef pair<double, double> pdd;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<ull, ull> pull;
using namespace __gnu_pbds;
typedef tree<ll, null_type, less<>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
using namespace std;
#ifdef ONPC
mt19937 rnd(228);
#else
mt19937 rnd(chrono::high_resolution_clock::now().time_since_epoch().count());
#endif
int32_t main()
{
ios::sync_with_stdio(0);
cin.tie(0);
string s;
vector<ll> ar(26);
getline( cin, s );
ll cc = 0;
FOR(i,0,sz(s))
{
if(s[i] >= 'a' && s[i] <= 'z')
s[i] += 'A' - 'a';
if(s[i] >= 'A' && s[i] <= 'Z'){
ar[s[i]-'A']++;
cc++;
}
}
sort(rall(ar));
vector<ll> arr = {1,3,3,5,5,5,7,7,7,7,7,9,9,9,9,9,9,9,9,11,11,11,11,11,11,11,11,11,11};
pll a;
a.x = 1;
a.y = 3;
ll res=0;
FOR(i,0,26)
{
res += ar[i] * arr[i];
}
res += (cc-1) * 3;
cout << res;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 3652kb
input:
ICPC
output:
17
result:
ok single line: '17'
Test #2:
score: 0
Accepted
time: 0ms
memory: 3552kb
input:
A
output:
1
result:
ok single line: '1'
Test #3:
score: 0
Accepted
time: 0ms
memory: 3840kb
input:
The quick brown dog jumps over the lazy fox.
output:
335
result:
ok single line: '335'
Test #4:
score: 0
Accepted
time: 0ms
memory: 3620kb
input:
Now is the time for all good men to come to the aid of their country. Fourscore and seven years ago our forefathers brought to this continent a new nation, conceived in liberty and dedicated to the proposition that all men are created equal.
output:
1607
result:
ok single line: '1607'
Test #5:
score: 0
Accepted
time: 0ms
memory: 3620kb
input:
We the People of the United States, in Order to form a more perfect Union, establish Justice, insure domestic Tranquility, provide for the common defence, promote the general Welfare, and secure the Blessings of Liberty to ourselves and our Posterity, do ordain and establish this Constitution for th...
output:
179819
result:
ok single line: '179819'
Test #6:
score: 0
Accepted
time: 0ms
memory: 3872kb
input:
QZciVKAgzAHHDgABJMhJvnKIwdSNqnnLPHnIAtGmsKUAxLBrzdLmsingreHuegdzTCnEMXLNFAILkhIuPvLzMefxpJIFNduQBnJAhsAkTRripMtFsfQaBxpyKnpvGEcgjClfxiuMLKuKwvfpbUwkeRsiEkcywOnsGmybWoWihMwhaRlAXOdoaZcsQSXfQfghItUnsEjvJhHAYEYSHRwidLDjIgKgkCkNaIXlylXOTAsUXeJwVMbiVHHvrQOmdlNjEFMvKCzlFCvtwwYZQoVjkoqSUZqCGIbMeCwNWOpuHHYG...
output:
347243
result:
ok single line: '347243'
Test #7:
score: 0
Accepted
time: 0ms
memory: 3656kb
input:
QbeEZdbSySOxwJrwsfzRlqnxuFvdFLukHwFtCUbFkbrOarmSeREicvBYfnUA
output:
549
result:
ok single line: '549'
Test #8:
score: 0
Accepted
time: 0ms
memory: 3612kb
input:
iMOMNqgkeWjFejBWIifAthLQOUkDwjvWwqIFRHvTupZmbmaMlGfqEKnQEQdRWNQfXgCDGsLKhjaLEcOrnZdHeeRxlaBiLBCnFKyJVmZbkRkkMePkWDczHEpTOkDQgHVyNVZEoqTTOBkLovaOeiqmuKtYBAPizRgMFDCVPthTCiLPItNkMpPCnffsvcwlxMnOxmBFbkHoNLCkuIqiTeaRSyvbycMCcZVzujKBDqwMGciKiTyrMjRsDrNDEDRBOrQwOUDiGCYdKKbGznSEpYMzwgZiyVzAWXKzNOjTUVamYoUR...
output:
21965
result:
ok single line: '21965'