Submission #1766892
Source Code Expand
#include<iostream> #include<cstdio> #include<vector> #include<map> #include<string> #include<sstream> #include<cmath> #include<climits> #include<algorithm> #include<bitset> #include<set> #include<stack> #include<queue> #include<iomanip> #include<memory.h> #include<complex> using namespace std; typedef long long ll; typedef vector<int> vi; typedef vector<vi> vvi; typedef tuple<int,int> tii; #define rep(i,n) for(ll i=0;i<(n);i++) #define pb push_back #define mt make_tuple #define ALL(a) (a).begin(),(a).end() #define FST first #define SEC second const int INF = (INT_MAX/2); const ll LLINF = (LLONG_MAX/2); const double eps = 1e-8; const double PI = M_PI; #define DEB cerr<<"!"<<endl #define SHOW(a,b) cerr<<(a)<<" "<<(b)<<endl #define SHOWARRAY(ar,i,j) REP(a,i)REP(b,j)cerr<<ar[a][b]<<((b==j-1)?((a==i-1)?("\n\n"):("\n")):(" ")) #define DIV int(1e9+7) inline ll pow(ll x,ll n,ll m){ll r=1;while(n>0){if((n&1)==1)r=r*x%m;x=x*x%m;n>>=1;}return r%m;} inline ll lcm(ll d1, ll d2){return d1 / __gcd(d1, d2) * d2;} /* Coding Space*/ int main(){ string s; cin >> s; vi in; rep(i,(int)s.size()){ if(s[i] == 'U') in.pb(1); else in.pb(0); } ll ans = 0; for(int i = 1; i <= (int)s.size(); i++){ if(in[i-1] == 0){ ans += 1*(i-1); ans += 2*(s.size()-i); }else{ ans += 2*(i-1); ans += 1*(s.size() - i); } } cout << ans << endl; }
Submission Info
Submission Time | |
---|---|
Task | B - Evilator |
User | cashisu1 |
Language | C++14 (GCC 5.4.1) |
Score | 400 |
Code Size | 1460 Byte |
Status | AC |
Exec Time | 6 ms |
Memory | 1020 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 | 6 ms | 1020 KB |
02.txt | AC | 6 ms | 1020 KB |
03.txt | AC | 6 ms | 1020 KB |
04.txt | AC | 6 ms | 1020 KB |
05.txt | AC | 5 ms | 1020 KB |
06.txt | AC | 5 ms | 1020 KB |
07.txt | AC | 5 ms | 1020 KB |
08.txt | AC | 5 ms | 1020 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 |