Submission #1311248


Source Code Expand

#define rep(i,n) for (int i=0;i<(n);i++)
#define repr(i,n) for (int i=(n)-1;i>=0;i--)

#define ll long long
#define ull unsigned long long
#define pii pair<int,int>
#define pcc pair<char,char>
#define pic pair<int,char>
#define pci pair<char,int>
#define vs vector<string>
#define vi vector<int>
#define vll vector<ll>
#define vd vector<double>
#define vc vector<char>

#define all(a) (a).begin(),(a).end()
#define range(a,i) (a).begin(),(a).begin()+i

#define sint(a) int a; scanf("%d",&a);
#define sint2(a,b) int a,b; scanf("%d %d",&a,&b);
#define sint3(a,b,c) int a,b,c; scanf("%d %d %d",&a,&b,&c);
#define sint4(a,b,c,d) int a,b,c,d; scanf("%d %d %d %d",&a,&b,&c,&d);
#define sint5(a,b,c,d,e) int a,b,c,d,e; scanf("%d %d %d %d %d",&a,&b,&c,&d,&e);
#define sll(a) ll a; scanf("%lld",&a);
#define sll2(a,b) ll a,b; scanf("%lld %lld",&a,&b);
#define sll3(a,b,c) ll a,b,c; scanf("%lld %lld %lld",&a,&b,&c);
#define sll4(a,b,c,d) ll a,b,c,d; scanf("%lld %lld %lld %lld",&a,&b,&c,&d);
#define sll5(a,b,c,d,e) ll a,b,c,d,e; scanf("%lld %lld %lld %lld %lld",&a,&b,&c,&d,&e);
#define svi(v,n) vector<int> v(n); rep(i,n) scanf("%d", &v[i]);
#define svll(v,n) vector<ll> v(n); rep(i,n) scanf("%lld", &v[i]);
#define sdouble(x) double x; scanf("%lf",&x);
#define svd(v,n) vector<double> v(n); rep(i,n) scanf("%lf", &v[i]);
#define schar(x) char x; scanf(" %c", &x);
#define sstring(x) string x; cin >> x;

#ifdef _MSC_VER
#define _CRT_SECURE_NO_WARNINGS
#endif

#ifdef _MSC_VER
#define DEBUG
#endif

#include <stdio.h>
#include <cstdio>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <numeric>
#include <climits>
#include <set>
#include <map>

using namespace std;




int main(int argc, char** argv) {
	sstring(S);
	int N = S.length();
	ll count = 0;
	rep(i, N) {
		if (S[i] == 'U') {
			count += i * 2;
			count += N - i - 1;
		}
		else {
			count += i;
			count += (N - i - 1) * 2;
		}
	}
	printf("%lld\n", count);
	return 0;
}

Submission Info

Submission Time
Task B - Evilator
User oxsoft
Language C++14 (GCC 5.4.1)
Score 400
Code Size 2059 Byte
Status AC
Exec Time 5 ms
Memory 512 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 5 ms 512 KB
02.txt AC 5 ms 512 KB
03.txt AC 5 ms 512 KB
04.txt AC 5 ms 512 KB
05.txt AC 4 ms 512 KB
06.txt AC 4 ms 512 KB
07.txt AC 4 ms 512 KB
08.txt AC 4 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