Submission #2231891
Source Code Expand
#define _CRT_SECURE_NO_WARNINGS #include <cstdio> #include <vector> #include <string> #include <iostream> #include <algorithm> #include <map> #include <iterator> #include <functional> #include <set> #include <stack> #include <queue> #include <deque> #include <fstream> #include <iomanip> #include <numeric> #include <cmath> #include <list> #include <sstream> #include <cstring> #include <stdio.h> #include <complex> using namespace std; #pragma GCC optimize("O3") #pragma GCC target("sse4") typedef long double LD; typedef long long LL; typedef unsigned long long ULL; typedef pair<int, int> PII; typedef pair<LD, LD> PDD; typedef pair<LL, LL> PLL; typedef vector<int> VI; typedef vector<LL> VLL; typedef vector<char> VCH; typedef vector<LD> VLD; typedef vector<string> VS; typedef vector<VS> VSS; typedef vector<VI> VVI; typedef vector<VLL> VVLL; typedef vector<VCH> VVCH; typedef vector<PII> VPII; typedef vector<PLL> VPLL; typedef vector<PDD> VPDD; #define MP make_pair #define PB push_back #define X first #define Y second #define next fake_next #define prev fake_prev #define left fake_left #define right fake_right #define FOR(i, a, b) for(int i = (a); i < (b); ++i) #define RFOR(i, b, a) for(int i = (b) - 1; i >= (a); --i) #define REP(i, t) FOR(i, 0, t) #define ALL(a) a.begin(), a.end() #define SZ(a) (int)((a).size()) #define FILL(a, value) memset(a, value, sizeof(a)) const LD PI = acos(-1.0); const LD EPS = 1e-6; const LL INF = 1e9; const LL LINF = 1e18; const LL mod = 1000000007; const LL MAX = 1e5 + 47; int main() { ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0); //freopen("In.txt", "r", stdin); string s; cin >> s; int n = SZ(s); LL ans = 2 * (n - 1); FOR(i, 1, n - 1) { if (s[i] == 'U') { ans += (n - i - 1); ans += 2 * i; } else { ans += 2 * (n - i - 1); ans += i; } } cout << ans; cin >> n; return 0; }
Submission Info
Submission Time | |
---|---|
Task | B - Evilator |
User | vjudge2 |
Language | C++14 (GCC 5.4.1) |
Score | 400 |
Code Size | 1872 Byte |
Status | AC |
Exec Time | 2 ms |
Memory | 512 KB |
Judge Result
Set Name | Sample | All | ||||
---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 400 / 400 | ||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | s1.txt, s2.txt |
All | 01.txt, 02.txt, 03.txt, 04.txt, 05.txt, 06.txt, 07.txt, 08.txt, 09.txt, 10.txt, s1.txt, s2.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
01.txt | AC | 2 ms | 512 KB |
02.txt | AC | 2 ms | 512 KB |
03.txt | AC | 2 ms | 512 KB |
04.txt | AC | 2 ms | 512 KB |
05.txt | AC | 2 ms | 512 KB |
06.txt | AC | 1 ms | 512 KB |
07.txt | AC | 1 ms | 512 KB |
08.txt | AC | 2 ms | 512 KB |
09.txt | AC | 1 ms | 256 KB |
10.txt | AC | 1 ms | 256 KB |
s1.txt | AC | 1 ms | 256 KB |
s2.txt | AC | 1 ms | 256 KB |