CSES - Putka Open 2015 – 3/6 - Results
Submission details
Task:Onnenluku
Sender:
Submission time:2015-09-13 20:49:03 +0300
Language:C++
Status:READY
Result:0
Feedback
groupverdictscore
#10
#20
#30
Test results
testverdicttimegroup
#10.05 s1details
#20.05 s1details
#30.05 s1details
#40.06 s1details
#50.05 s1details
#60.05 s2details
#70.05 s2details
#80.05 s2details
#90.04 s2details
#100.07 s2details
#110.05 s3details
#120.05 s3details
#130.05 s3details
#140.05 s3details
#150.05 s3details

Compiler report

input/code.cpp: In function 'long long int g(std::string)':
input/code.cpp:20:21: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for (int i = 0; i < s.length()-1; i++) {
                     ^
input/code.cpp:24:21: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for (int i = 0; i < s.length()-2; i++) {
                     ^
input/code.cpp:30:21: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for (int i = 0; i < s.length()-1; i++) {
                     ^
input/code.cpp:36:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for (int i = 2; i < s.length(); i++) {
                    ^
input/code.cpp: In function 'long long int f(std::string)':
input/code.cpp:52:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for (int i = 2; i <= s.length()-1; i++) {
                    ^
input/code...

Code

#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

#define ll long long

string a,b;
ll d[51][51];

ll g(string s)
{
	ll r = 0;
	ll t = 0;
	ll u = 0;
	int x = s[0] - '0';
	int y = s[1] - '0';
	if (y > x) {
		for (int i = 0; i < s.length()-1; i++) {
			r += d[s.length()-1][i];
		}
		r *= (y-2);
		for (int i = 0; i < s.length()-2; i++) {
			t += d[s.length()-2][i];
		}
		t *= 8;
		cout << r << " " << t << "\n";
	} else {
		for (int i = 0; i < s.length()-1; i++) {
			r += d[s.length()-2][i];
		}
		r *= (y-1);
	}
	u = 1;
	for (int i = 2; i < s.length(); i++) {
		if (s[i] - '0' < x && s[i] - '0'  < y) {
			u *= 0;
		} else if (s[i] - '0' < x || s[i] - '0'  < y) {
			u *= 1;
		} else {
			u *= 2;
		}
	}
	cout << u << "\n";
	return r+t+u;
}

ll f(string s)
{
	ll p = 0;
	for (int i = 2; i <= s.length()-1; i++) {
		for (int j = 1; j <= i-1; j++) {
			p += d[i][j];
		}
	}
	p *= 36;
	ll q = 0;
	for (int i = 1; i <= s.length()-1; i++) {
		q += d[s.length()][i];
	}
	int x = s[0] - '0';
	q *= 4*(x-1);
	cout << s << " " << p << " " << q << "\n";
	return p+q+g(s);
}

int main()
{
	cin >> a >> b;
	for (int i = 0; i <= b.length(); i++) {
		d[i][0] = 1;
		for (int j = 1; j <= i; j++) {
			d[i][j] = d[i-1][j-1]+d[i-1][j];
		}
	}
	cout << f(b)-f(a) << "\n";
}

Test details

Test 1

Group: 1

Verdict:

input
2157 93337

correct output
1421

user output
93337 792 960
1
2157 288 56
4
1421

Test 2

Group: 1

Verdict:

input
4875 95124

correct output
1278

user output
95124 792 960
0
4875 288 168
42 24
1
...

Test 3

Group: 1

Verdict:

input
5577 96352

correct output
1245

user output
96352 792 960
0
5577 288 224
4
1260

Test 4

Group: 1

Verdict:

input
8362 92950

correct output
1076

user output
92950 792 960
0
8362 288 392
0
1072

Test 5

Group: 1

Verdict:

input
5658 96660

correct output
1238

user output
96660 792 960
0
5658 288 224
28 24
2
...

Test 6

Group: 2

Verdict:

input
51312303535233 994542403556353

correct output
1453976

user output
994542403556353 1178568 104851...

Test 7

Group: 2

Verdict:

input
25636920452341 934558290712847

correct output
1544072

user output
934558290712847 1178568 104851...

Test 8

Group: 2

Verdict:

input
7917952071965 985207415843573

correct output
1763176

user output
985207415843573 1178568 104851...

Test 9

Group: 2

Verdict:

input
48991581181227 907034837225965

correct output
1380248

user output
907034837225965 1178568 104851...

Test 10

Group: 2

Verdict:

input
47968703305149 924246001328437

correct output
1396632

user output
924246001328437 1178568 104851...

Test 11

Group: 3

Verdict:

input
292953755324413237753216241025...

correct output
53286731528535944

user output
964639173465641885118821775152...

Test 12

Group: 3

Verdict:

input
373990979330820426927419348165...

correct output
51580289482227600

user output
977668755802888729058816959604...

Test 13

Group: 3

Verdict:

input
701417326319476057561825658890...

correct output
42924933948374952

user output
918326538401170614302283223435...

Test 14

Group: 3

Verdict:

input
177202883511434557056457305647...

correct output
54500592365600640

user output
918019359041103223405147363607...

Test 15

Group: 3

Verdict:

input
977665117437419620152569155919...

correct output
38562071809359800

user output
950759532923827350258080029117...