Submission #1607758


Source Code Expand

#pragma region include
#include <iostream>
#include <iomanip>
#include <stdio.h>

#include <sstream>
#include <algorithm>
#include <iterator>
#include <cmath>
#include <complex>

#include <string>
#include <cstring>
#include <vector>
#include <tuple>
#include <bitset>

#include <queue>
#include <complex>
#include <set>
#include <map>
#include <stack>
#include <list>

#include <fstream>
#include <random>
//#include <time.h>
#include <ctime>
#pragma endregion //#include
/////////
#define REP(i, x, n) for(int i = x; i < n; ++i)
#define rep(i,n) REP(i,0,n)
#define ALL(X) X.begin(), X.end()
/////////
#pragma region typedef
typedef long long LL;
typedef long double LD;
typedef unsigned long long ULL;
typedef std::pair<LL,LL> PLL;//
typedef std::pair<int,int> PII;//
#pragma endregion //typedef
////定数
const int INF = (int)1e9;
const LL MOD = (LL)1e9+7;
const LL LINF = (LL)1e18+20;
const LD PI = acos(-1.0);
const double EPS = 1e-9;
/////////
using namespace::std;

void solve(){
	string str;
	cin >> str;
	int size = str.size();
	if( size > 2000 ){
		return;
	}
	map<string,LL> wordList;
	for(int i=0;i<size;++i){
		for(int j=1;i+j<=size;++j){
			wordList[str.substr(i,j)] = j;
		}
	}
	LL ans = 0;
	map<string,LL>::iterator itr,end;
	itr = wordList.begin();
	end = wordList.end();
	for(;itr!=end;++itr){
		ans += itr->second;
	}
	cout << ans << endl;
}

#pragma region main
signed main(void){
	std::cin.tie(0);
	std::ios::sync_with_stdio(false);
	std::cout << std::fixed;//小数を10進数表示
	cout << setprecision(16);//小数点以下の桁数を指定//coutとcerrで別	

	solve();
}
#pragma endregion //main()

Submission Info

Submission Time
Task E - 部分文字列
User akarin55
Language C++14 (GCC 5.4.1)
Score 15
Code Size 1709 Byte
Status WA
Exec Time 2191 ms
Memory 1434624 KB

Judge Result

Set Name Sample Subtask1 Subtask2 Subtask3
Score / Max Score 0 / 0 15 / 15 0 / 35 0 / 50
Status
AC × 3
AC × 12
AC × 12
TLE × 1
MLE × 1
AC × 12
WA × 3
TLE × 1
MLE × 1
Set Name Test Cases
Sample sample_1.txt, sample_2.txt, sample_3.txt
Subtask1 sample_1.txt, sample_2.txt, sample_3.txt, sub1_1.txt, sub1_2.txt, sub1_3.txt, sub1_4.txt, sub1_5.txt, sub1_6.txt, sub1_7.txt, sub1_8.txt, sub1_9.txt
Subtask2 sample_1.txt, sample_2.txt, sample_3.txt, sub1_1.txt, sub1_2.txt, sub1_3.txt, sub1_4.txt, sub1_5.txt, sub1_6.txt, sub1_7.txt, sub1_8.txt, sub1_9.txt, sub2_1.txt, sub2_2.txt
Subtask3 sample_1.txt, sample_2.txt, sample_3.txt, sub1_1.txt, sub1_2.txt, sub1_3.txt, sub1_4.txt, sub1_5.txt, sub1_6.txt, sub1_7.txt, sub1_8.txt, sub1_9.txt, sub2_1.txt, sub2_2.txt, sub3_1.txt, sub3_2.txt, sub3_3.txt
Case Name Status Exec Time Memory
sample_1.txt AC 1 ms 256 KB
sample_2.txt AC 1 ms 256 KB
sample_3.txt AC 1 ms 256 KB
sub1_1.txt AC 1 ms 256 KB
sub1_2.txt AC 1 ms 256 KB
sub1_3.txt AC 2 ms 384 KB
sub1_4.txt AC 1 ms 384 KB
sub1_5.txt AC 2 ms 384 KB
sub1_6.txt AC 3 ms 640 KB
sub1_7.txt AC 2 ms 256 KB
sub1_8.txt AC 2 ms 512 KB
sub1_9.txt AC 3 ms 640 KB
sub2_1.txt MLE 478 ms 214400 KB
sub2_2.txt TLE 2191 ms 1434624 KB
sub3_1.txt WA 1 ms 256 KB
sub3_2.txt WA 1 ms 256 KB
sub3_3.txt WA 1 ms 512 KB