Submission #24513688


Source Code Expand

Copy
#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9+7;
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
string sample = "chokudai";
map<char, vector<int>> mp;
for ( int j = 0 ; j < 8 ; j++ )
{
vector<int> p;
mp[sample[j]] = p;
}
map<int, long long> ans;
long long count = 0;
string s;
cin >> s;
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#include <bits/stdc++.h>
using namespace std;

const int mod = 1e9+7;

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	string sample = "chokudai";
	map<char, vector<int>> mp;
	for ( int j = 0 ; j < 8 ; j++ )
	{
		vector<int> p;
		mp[sample[j]] = p;
	}
	map<int, long long> ans;
	long long count = 0;
	string s;
	cin >> s;
	
	for ( int i = 0 ; i < s.size() ; i++ )
	{
		if ( mp.find(s[i]) != mp.end() )
		{
			mp[s[i]].push_back(i);
		}
	}
	
	for ( char c : sample )
	{
		map<int, long long> temp;
		temp = ans;
		for ( int p : mp[c] )
		{
			if ( c == 'c' )
			{
				temp[p] = 1;
			}
			else
			{
				for ( auto pp : ans )
				{
					temp.erase(pp.first);
					if ( p > pp.first )
					{
						temp[p]+=pp.second;
						temp[p]%=mod;
					}
				}
			}
		}
		ans = temp;
	}
	
	for ( auto a : ans )
	{
		count += a.second;
		count %= mod;
	}
	
	cout << count;
}

Submission Info

Submission Time
Task C - chokudai
User TanKaiYi0220
Language C++ (GCC 9.2.1)
Score 0
Code Size 939 Byte
Status TLE
Exec Time 2205 ms
Memory 5416 KB

Compile Error

./Main.cpp: In function ‘int main()’:
./Main.cpp:22:22: warning: comparison of integer expressions of different signedness: ‘int’ and ‘std::__cxx11::basic_string<char>::size_type’ {aka ‘long unsigned int’} [-Wsign-compare]
   22 |  for ( int i = 0 ; i < s.size() ; i++ )
      |                    ~~^~~~~~~~~~

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 300
Status
AC × 3
AC × 12
TLE × 7
Set Name Test Cases
Sample example0.txt, example1.txt, example2.txt
All 000.txt, 001.txt, 002.txt, 003.txt, 004.txt, 005.txt, 006.txt, 007.txt, 008.txt, 009.txt, 010.txt, 011.txt, 012.txt, 013.txt, 014.txt, 015.txt, example0.txt, example1.txt, example2.txt
Case Name Status Exec Time Memory
000.txt AC 8 ms 3544 KB
001.txt AC 4 ms 3528 KB
002.txt AC 5 ms 3628 KB
003.txt AC 26 ms 3580 KB
004.txt AC 21 ms 3632 KB
005.txt AC 25 ms 3560 KB
006.txt AC 19 ms 3644 KB
007.txt AC 4 ms 3488 KB
008.txt TLE 2205 ms 3960 KB
009.txt TLE 2205 ms 4072 KB
010.txt TLE 2205 ms 3864 KB
011.txt TLE 2205 ms 5248 KB
012.txt TLE 2205 ms 5416 KB
013.txt TLE 2205 ms 5348 KB
014.txt TLE 2205 ms 5204 KB
015.txt AC 1069 ms 5144 KB
example0.txt AC 2 ms 3576 KB
example1.txt AC 2 ms 3524 KB
example2.txt AC 2 ms 3520 KB


2025-02-28 (Fri)
11:10:51 +00:00