Submission #1540699
Source Code Expand
#include <iostream> #include <sstream> #include <fstream> #include <cstdio> #include <cstdlib> #include <cmath> #include <cctype> #include <cstring> #include <algorithm> #include <numeric> #include <functional> #include <string> #include <vector> #include <deque> #include <stack> #include <queue> #include <list> #include <map> // #include <unordered_map> #include <set> #include <utility> #include <bitset> #include <limits> #include <climits> using namespace std; #ifdef DEBUG #define NDEBUG #include "cout11.h" #endif #undef NDEBUG #include <cassert> typedef long long ll; #define rep(var,n) for(int var=0;var<(n);++var) int main() { char buf[200003]; fgets(buf,200003,stdin); int L=0; vector<ll> cnt(26, 0); rep(i, 200003){ if (buf[i] < 'a') { buf[i] = 0; L = i; break; } ++cnt[buf[i]-'a']; } ll ans = 0; rep(i,26){ ans += cnt[i] * (L - cnt[i]); } ans = ans/2 + 1; cout << ans << endl; return 0; }
Submission Info
Submission Time | |
---|---|
Task | B - Reverse and Compare |
User | naoya_t |
Language | C++14 (GCC 5.4.1) |
Score | 500 |
Code Size | 1058 Byte |
Status | AC |
Exec Time | 2 ms |
Memory | 384 KB |
Compile Error
./Main.cpp: In function ‘int main()’: ./Main.cpp:41:28: warning: ignoring return value of ‘char* fgets(char*, int, FILE*)’, declared with attribute warn_unused_result [-Wunused-result] fgets(buf,200003,stdin); ^
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 | 2 ms | 384 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 | 1 ms | 256 KB |
subtask_1_07.txt | AC | 1 ms | 256 KB |
subtask_1_08.txt | AC | 2 ms | 384 KB |
subtask_1_09.txt | AC | 1 ms | 384 KB |
subtask_1_10.txt | AC | 2 ms | 384 KB |
subtask_1_11.txt | AC | 1 ms | 384 KB |
subtask_1_12.txt | AC | 2 ms | 384 KB |
subtask_1_13.txt | AC | 2 ms | 384 KB |
subtask_1_14.txt | AC | 2 ms | 384 KB |
subtask_1_15.txt | AC | 2 ms | 384 KB |
subtask_1_16.txt | AC | 2 ms | 384 KB |
subtask_1_17.txt | AC | 2 ms | 384 KB |