Submission #8280864
Source Code Expand
#include <bits/stdc++.h>
using namespace std;
int main()
{
string S;
cin >> S;
int cnt = 0;
int minV = 0;
vector<int> V(S.size() + 1, 0);
int sum = 0;
int i = 0;
while (1) {
int inc = 0;
int dec = 0;
while (S[i] == '<') {
inc++, i++;
if (i > S.size()) break;
}
while (S[i] == '>') {
dec++, i++;
if (i > S.size()) break;
}
sum += (max(dec, inc) + 0) * (max(dec, inc) + 1) / 2;
sum += min(dec, inc) * (min(dec, inc) - 1) / 2;
if (i >= S.size()) break;
}
cout << sum << endl;
}
Submission Info
| Submission Time | |
|---|---|
| Task | A - >< |
| User | alteis |
| Language | C++14 (GCC 5.4.1) |
| Score | 0 |
| Code Size | 672 Byte |
| Status | WA |
| Exec Time | 21 ms |
| Memory | 2820 KiB |
Judge Result
| Set Name | Sample | All | ||||
|---|---|---|---|---|---|---|
| Score / Max Score | 0 / 0 | 0 / 300 | ||||
| Status | AC |
|
| Set Name | Test Cases |
|---|---|
| Sample | |
| All | 00-sample-01.txt, 00-sample-02.txt, 01-01.txt, 01-02.txt, 01-03.txt, 01-04.txt, 01-05.txt, 01-06.txt, 01-07.txt, 01-08.txt, 01-09.txt, 01-10.txt, 01-11.txt, 01-12.txt, 01-13.txt |
| Case Name | Status | Exec Time | Memory |
|---|---|---|---|
| 00-sample-01.txt | AC | 1 ms | 256 KiB |
| 00-sample-02.txt | AC | 1 ms | 256 KiB |
| 01-01.txt | AC | 1 ms | 256 KiB |
| 01-02.txt | AC | 17 ms | 2308 KiB |
| 01-03.txt | AC | 20 ms | 2692 KiB |
| 01-04.txt | AC | 9 ms | 1412 KiB |
| 01-05.txt | AC | 21 ms | 2820 KiB |
| 01-06.txt | WA | 18 ms | 2820 KiB |
| 01-07.txt | WA | 18 ms | 2820 KiB |
| 01-08.txt | WA | 18 ms | 2820 KiB |
| 01-09.txt | WA | 18 ms | 2820 KiB |
| 01-10.txt | WA | 18 ms | 2820 KiB |
| 01-11.txt | WA | 18 ms | 2820 KiB |
| 01-12.txt | WA | 18 ms | 2820 KiB |
| 01-13.txt | WA | 18 ms | 2820 KiB |