QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#799708#8244. Digit TranslationYarema#WA 135ms12132kbC++201.1kb2024-12-05 17:13:302024-12-05 17:13:31

Judging History

你现在查看的是最新测评结果

  • [2024-12-05 17:13:31]
  • 评测
  • 测评结果:WA
  • 用时:135ms
  • 内存:12132kb
  • [2024-12-05 17:13:30]
  • 提交

answer

#include <bits/stdc++.h>

using namespace std;

#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define RFOR(i, a, b) for(int i = (a) - 1; i >= (b); i--)
#define SZ(a) int(a.size())
#define ALL(a) a.begin(), a.end()
#define PB push_back
#define MP make_pair
#define F first
#define S second

typedef long long LL;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef pair<int, int> PII;
typedef pair<LL, LL> PLL;
typedef double db;

const int INF = 1e9;

int main()
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	
	string s;
	cin >> s;
	vector<string> v = {"zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine"};
	int n = SZ(s);
	vector<PII> dp(n + 1, {INF, 1});
	dp[0] = {0, 1};
	FOR (i, 0, n)
	{
		dp[i + 1] = {dp[i].F + 1, dp[i].S};
		for (auto ss : v)
		{
			if (i + 1 >= SZ(ss) && s.substr(i + 1 - SZ(ss), SZ(ss)) == ss)
			{
				PII p = dp[i - SZ(ss) + 1];
				p.F++;
				if (p.F < dp[i + 1].F)
					dp[i + 1] = {p.F, p.S};
				else if (p.F == dp[i + 1].F)
					dp[i + 1].S += p.S;
			}
		}
	}
	cout << dp[n].F << '\n' << dp[n].S << '\n';
	
	
	
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 3632kb

input:

icecreamcone

output:

10
1

result:

ok 2 lines

Test #2:

score: 0
Accepted
time: 0ms
memory: 3672kb

input:

onetwo

output:

2
1

result:

ok 2 lines

Test #3:

score: 0
Accepted
time: 0ms
memory: 3672kb

input:

twone

output:

3
2

result:

ok 2 lines

Test #4:

score: 0
Accepted
time: 0ms
memory: 3636kb

input:

a

output:

1
1

result:

ok 2 lines

Test #5:

score: 0
Accepted
time: 0ms
memory: 3576kb

input:

zero

output:

1
1

result:

ok 2 lines

Test #6:

score: 0
Accepted
time: 0ms
memory: 3576kb

input:

one

output:

1
1

result:

ok 2 lines

Test #7:

score: 0
Accepted
time: 0ms
memory: 3572kb

input:

two

output:

1
1

result:

ok 2 lines

Test #8:

score: 0
Accepted
time: 0ms
memory: 3520kb

input:

three

output:

1
1

result:

ok 2 lines

Test #9:

score: 0
Accepted
time: 0ms
memory: 3524kb

input:

four

output:

1
1

result:

ok 2 lines

Test #10:

score: 0
Accepted
time: 0ms
memory: 3836kb

input:

five

output:

1
1

result:

ok 2 lines

Test #11:

score: 0
Accepted
time: 0ms
memory: 3792kb

input:

six

output:

1
1

result:

ok 2 lines

Test #12:

score: 0
Accepted
time: 0ms
memory: 3872kb

input:

seven

output:

1
1

result:

ok 2 lines

Test #13:

score: 0
Accepted
time: 0ms
memory: 3524kb

input:

eight

output:

1
1

result:

ok 2 lines

Test #14:

score: 0
Accepted
time: 0ms
memory: 3580kb

input:

nine

output:

1
1

result:

ok 2 lines

Test #15:

score: 0
Accepted
time: 131ms
memory: 12132kb

input:

enfzncejemisgzoqnzkgtltxvxybvwddlpsndjyemdcbxyifzjygquvkvbmuhoblihvbxuthwryohdosidsfuzpzgixpkconlbpgscilqqvpblzmwuyrmvwngpnftlcmkjrjsdvgosnnbkldmrrkmucrqyulyxpqehztlssgpmcdsmzylvzaclzgvzaaajsfyyssmthmlaxmudbmmubwdtuifgryoxhorzhjvqxmjcqirlcmvfuttraqyjeztbilbvygakdhxzvyrqcddljjcgzcolvqljabluixyerpevtp...

output:

999618
2

result:

ok 2 lines

Test #16:

score: -100
Wrong Answer
time: 135ms
memory: 12048kb

input:

zerofoureightfourzerofourthreesixfiveonesixoneighteighthreefoursixzeroeighteightzeroneightsevenfourseveneightwoeightwosixninesevenseventwonineightonezerosixonesixsixsixzeroeightsixzerothreefoursevenfourfiveninefiveninetwofouronesevenseventhreesixfoursixfourninesixonesevenzerofourzeroninezeroseveneig...

output:

290113
0

result:

wrong answer 2nd lines differ - expected: '4873734', found: '0'