Submission #2234660


Source Code Expand

# include <iostream>
# include <algorithm>
#include <array>
# include <cassert>
#include <cctype>
#include <climits>
#include <numeric>
# include <vector>
# include <string>
# include <set>
# include <map>
# include <cmath>
# include <iomanip>
# include <functional>
# include <tuple>
# include <utility>
# include <stack>
# include <queue>
# include <list>
# include <bitset>
# include <complex>
# include <chrono>
# include <random>
# include <limits.h>
# include <unordered_map>
# include <unordered_set>
# include <deque>
# include <cstdio>
# include <cstring>
using namespace std;
using LL = long long;
using ULL = unsigned long long;
constexpr long long MOD = 1000000000 + 7;
constexpr long long INF = std::numeric_limits<long long>::max();
const double PI = acos(-1);
#define fir first
#define sec second
typedef pair<LL, LL> Pll;
typedef pair<LL, pair<LL, LL>> Ppll;
typedef pair<LL, pair<LL, bitset<100001>>> Pbll;
typedef pair<LL, pair<LL, vector<LL>>> Pvll;
typedef pair<LL, LL> Vec2;
struct Tll { LL first, second, third; };
typedef pair<LL, Tll> Ptll;
#define rep(i,rept) for(LL i=0;i<rept;i++)
#define Mfor(i,mf) for(LL i=mf-1;i>=0;i--)
LL h, w, n, m, k, s, t, q, ans, sum, last, cnt, a[2];
struct Edge { LL to,cost; };
vector<Edge>vec[100000];
string str;
bool f=0;
void YN(bool f) {
	if (f)
		cout << "YES" << endl;
	else
		cout << "NO" << endl;
}
void yn(bool f) {
	if (f)
		cout << "Yes" << endl;
	else
		cout << "No" << endl;
}
int main() {
	cin >> str;
	rep(i, str.size()) {
		if (str[i] == 'U') {
			ans += i * 2 + (str.size() - i - 1);
		}
		else {
			ans += i + (str.size() - i - 1) * 2;
		}
	}
	cout << ans << endl;
	return 0;
}

Submission Info

Submission Time
Task B - Evilator
User akusyounin
Language C++14 (GCC 5.4.1)
Score 400
Code Size 1727 Byte
Status AC
Exec Time 6 ms
Memory 2816 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 400 / 400
Status
AC × 2
AC × 12
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 6 ms 2816 KB
02.txt AC 6 ms 2816 KB
03.txt AC 6 ms 2816 KB
04.txt AC 6 ms 2816 KB
05.txt AC 6 ms 2816 KB
06.txt AC 6 ms 2816 KB
07.txt AC 6 ms 2816 KB
08.txt AC 6 ms 2816 KB
09.txt AC 2 ms 2560 KB
10.txt AC 2 ms 2560 KB
s1.txt AC 2 ms 2560 KB
s2.txt AC 2 ms 2560 KB