QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#585451#1773. Breaking BarsKarL06WA 1489ms164004kbC++205.5kb2024-09-23 20:52:242024-09-23 20:52:33

Judging History

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

  • [2024-09-23 20:52:33]
  • 评测
  • 测评结果:WA
  • 用时:1489ms
  • 内存:164004kb
  • [2024-09-23 20:52:24]
  • 提交

answer

#include <bits/stdc++.h>

using namespace std;

#define pb push_back
#define mp make_pair
#define nL '\n'
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define int long long

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> pii;
typedef vector<pii> vpii;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<ll, ll> pll;
typedef vector<pll> vpll;

const ll MOD = 1e9 + 7;

void settings()__attribute__((constructor));

void eval(bool condition) { cout << (condition ? "yes" : "no") << nL; }
void Eval(bool condition) { cout << (condition ? "Yes" : "No") << nL; }
void EVAL(bool condition) { cout << (condition ? "YES" : "NO") << nL; }

int ipow(int a, int n) {
   if (n == 0) return 1;
   int x = ipow(a, n/2);
   if (n % 2 == 0) return x*x;
   return x*x*a;
}

template <typename T>
ostream& operator<<(ostream& stream, const vector<T>& v) {
	for (auto elem : v) 
		stream << elem << " ";
	return stream;
}

template <typename T>
istream& operator>>(istream& stream, vector<T>& v){
   for(auto &elem : v)
		stream >> elem;
   return stream;
}

void settings() {
	#ifdef LOCAL
		freopen("io/input.txt", "r", stdin);
		freopen("io/output.txt", "w", stdout);
	#endif

	ios::sync_with_stdio(0);
	cin.tie(0);
}

vector<map<vi, int>> dp;
map<pii, int> mapper;
map<int, pii> invMapper;

int toMask(const vi& a) {
	int res = 0;
	for (int i = 0; i < a.size(); i++) res += (1LL<<i)*a[i];

	return res;
}

bool emp(const vi& a) {
	bool res = true;
	for (int i = 0; i < a.size(); i++)res &= a[i] == 0;
		return res;
}

int MAX_X = 2;
int res1 = -1;
int cnt = 0;

int currX = 0;

int getDP(int t, vi& a) {
	// if (res1 != -1) cnt++;
	// if (cnt >= 1000000) return INT_MAX;
	
	if (t <= 0) return 0;
	if (dp[t].count(a)) return dp[t][a];

	// if (res1 != -1 && currX >= res1) {
	// 	return INT_MAX;
	// }

	if (emp(a) && t > 0) return INT_MAX;

	int idx = 0;
	for (int i = 20; i >= 0; i--) {
		if (a[i] > 0) {
			idx = i;
			break;
		}
	}

	pii curr = invMapper[idx];

	vi oldA = a;
	for (int i = 0; i < 21; i++) {
		if (a[i] > MAX_X) {
			int tmp = a[i]-MAX_X;
			if (tmp % 2 == 1) tmp++;
			// cout << tmp << nL;
			a[i] -= tmp;
			dp[t][oldA] = getDP(t-invMapper[i].first*invMapper[i].second*(tmp/2), a);
			a[i] += tmp;
			return dp[t][oldA];
		}
	}

	int tmp = a[idx];
	a[idx] = 0;
	dp[t][oldA] = getDP(t-curr.first*curr.second*(tmp/2), a);
	a[idx] = tmp;

	for (int i = 1; i < curr.first; i++) {
		a[idx]--;
		a[(mapper[{i, curr.second}])]++;
		a[(mapper[{curr.first-i, curr.second}])]++;

		currX++;
		dp[t][oldA] = min(dp[t][oldA], getDP(t, a)+1);
		currX--;

		a[idx]++;
		a[(mapper[{i, curr.second}])]--;
		a[(mapper[{curr.first-i, curr.second}])]--;
	}

	for (int i = 1; i < curr.second; i++) {
		a[idx]--;

		a[(mapper[{curr.first, i}])]++;
		a[(mapper[{curr.first, curr.second-i}])]++;

		currX++;
		dp[t][oldA] = min(dp[t][oldA], getDP(t, a)+1);
		currX--;

		a[idx]++;

		a[(mapper[{curr.first, i}])]--;
		a[(mapper[{curr.first, curr.second-i}])]--;
	}

	return dp[t][oldA];
}

vector<map<vi, int>> dp2;
clock_t time_req;

int getDP2(int br, vi& a) {
	if ((float)(clock()- time_req)/CLOCKS_PER_SEC > 1.5) {
		return 0;
	}
	if (dp2[br].count(a)) return dp2[br][a];
	if (br == 0) {
		int tmp = 0;
		for (int i = 0; i < 21; i++) {
			tmp += (a[i]/2)*invMapper[i].first*invMapper[i].second;
		}
		dp2[br][a] = tmp;
		return tmp;
	}

	vi oldA = a;
	dp2[br][oldA] = getDP2(br-1, a);

	int idx = 0;
	for (int i = 20; i >= 0; i--) {
		if (a[i] > 0) {
			idx = i;
			break;
		}
	}

	int tmp = a[idx];
	a[idx] = 0;
	dp2[br][oldA] = getDP2(br, a)+(tmp/2)*invMapper[idx].first*invMapper[idx].second;
	a[idx] = tmp;

	pii curr = invMapper[idx];
	for (int i = 1; i < curr.first; i++) {
		a[idx]--;
		a[(mapper[{i, curr.second}])]++;
		a[(mapper[{curr.first-i, curr.second}])]++;

		dp2[br][oldA] = max(dp2[br][oldA], getDP2(br-1, a));

		a[idx]++;
		a[(mapper[{i, curr.second}])]--;
		a[(mapper[{curr.first-i, curr.second}])]--;
	}

	for (int i = 1; i < curr.second; i++) {
		a[idx]--;

		a[(mapper[{curr.first, i}])]++;
		a[(mapper[{curr.first, curr.second-i}])]++;
		
		dp2[br][oldA] = max(dp2[br][oldA], getDP2(br-1, a));
		// cout << curr.first << " " << curr.second << " " << dp[br][oldA] << nL;
		a[idx]++;

		a[(mapper[{curr.first, i}])]--;
		a[(mapper[{curr.first, curr.second-i}])]--;
	}

	return dp2[br][oldA];
}

signed main() {
	time_req = clock();

	int idx = 0;
	for (int i = 1; i <= 6; i++) {
		for (int j = i; j <= 6; j++) {
			mapper[{i, j}] = idx;
			invMapper[idx] = {i, j};
			mapper[{j, i}] = idx++;
		}
	}

	int n, t;
	cin >> n >> t;
	vi a(21);
	for (int i = 0; i < n; i++) {
		string s;
		cin >> s;
		a[mapper[{s[0]-'0', s[2]-'0'}]]++;
	}

	// for (int i = 0; i < 21; i++) {
	// 	t -= invMapper[i].first*invMapper[i].second*(a[i]/2);
	// 	a[i] %= 2;
	// }
	// cout << a << nL;
	dp = vector<map<vi, int>>(t+5);

	MAX_X = 1;
	res1 = getDP(t, a);
	dp2 = vector<map<vi, int>>(res1+5);
	// MAX_X = 2;
	// cout << min(res1, getDP(t, a)) << nL;

	for (int i = 0; i <= res1; i++) {
		if ((float)(clock()- time_req)/CLOCKS_PER_SEC > 1.0) {
			cout << res1 << nL;
			break;
		}
		if (getDP2(i, a) < t) continue;
		cout << i << nL;
		break;
	}
	// cout << (float)(clock()- time_req)/CLOCKS_PER_SEC << nL;

	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 39ms
memory: 9456kb

input:

16 118
5x6 3x5 4x5 6x3 6x1 1x1 4x5 4x5 2x3 1x2 5x3 5x3 6x2 3x6 5x6 4x2

output:

4

result:

ok single line: '4'

Test #2:

score: 0
Accepted
time: 1ms
memory: 3964kb

input:

6 30
2x3 3x3 1x5 2x5 3x5 3x5

output:

2

result:

ok single line: '2'

Test #3:

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

input:

3 2
1x1 1x1 1x2

output:

1

result:

ok single line: '1'

Test #4:

score: 0
Accepted
time: 2ms
memory: 3976kb

input:

4 25
2x3 3x3 2x5 5x5

output:

2

result:

ok single line: '2'

Test #5:

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

input:

5 10
1x1 1x1 1x1 1x1 4x4

output:

1

result:

ok single line: '1'

Test #6:

score: 0
Accepted
time: 1ms
memory: 3700kb

input:

6 34
1x1 1x2 2x3 3x3 5x5 5x5

output:

2

result:

ok single line: '2'

Test #7:

score: 0
Accepted
time: 189ms
memory: 27556kb

input:

15 70
1x1 1x2 1x3 1x4 1x5 2x2 2x3 2x4 2x5 3x3 3x4 3x5 4x4 4x5 5x5

output:

7

result:

ok single line: '7'

Test #8:

score: 0
Accepted
time: 1ms
memory: 4084kb

input:

11 40
1x1 1x2 1x3 2x3 2x4 4x5 2x2 2x2 1x4 2x4 4x5

output:

3

result:

ok single line: '3'

Test #9:

score: 0
Accepted
time: 64ms
memory: 13296kb

input:

20 74
4x3 5x1 4x2 3x3 1x2 2x1 4x2 1x5 1x1 1x4 1x1 5x5 1x4 4x5 3x2 3x5 1x2 3x4 1x1 2x3

output:

6

result:

ok single line: '6'

Test #10:

score: 0
Accepted
time: 106ms
memory: 18188kb

input:

20 104
4x2 2x3 4x5 5x1 1x3 4x3 1x2 1x1 5x2 5x4 5x5 4x1 5x5 3x5 4x2 3x1 3x1 5x4 2x1 4x4

output:

6

result:

ok single line: '6'

Test #11:

score: 0
Accepted
time: 8ms
memory: 5704kb

input:

13 44
5x4 3x2 3x2 4x1 4x4 1x2 1x5 1x2 1x1 3x5 1x2 1x3 3x2

output:

5

result:

ok single line: '5'

Test #12:

score: 0
Accepted
time: 2ms
memory: 3864kb

input:

5 21
1x3 1x2 5x4 4x4 1x1

output:

3

result:

ok single line: '3'

Test #13:

score: 0
Accepted
time: 87ms
memory: 15568kb

input:

18 77
5x4 4x2 5x5 1x4 3x1 4x3 2x3 1x1 3x4 5x2 5x3 2x2 2x1 2x1 1x2 5x3 3x3 1x4

output:

6

result:

ok single line: '6'

Test #14:

score: 0
Accepted
time: 5ms
memory: 4536kb

input:

9 30
5x2 5x3 1x4 1x4 2x3 1x2 3x3 2x3 4x1

output:

5

result:

ok single line: '5'

Test #15:

score: 0
Accepted
time: 2ms
memory: 4304kb

input:

8 37
2x4 1x3 5x4 5x5 2x4 1x4 1x2 1x4

output:

2

result:

ok single line: '2'

Test #16:

score: 0
Accepted
time: 420ms
memory: 47180kb

input:

19 103
1x5 5x2 2x2 5x4 1x5 1x1 5x5 2x2 2x5 5x4 3x4 3x2 4x4 5x4 5x3 2x2 2x4 4x3 3x3

output:

7

result:

ok single line: '7'

Test #17:

score: 0
Accepted
time: 142ms
memory: 22612kb

input:

19 75
2x1 1x1 5x5 2x4 1x3 2x3 2x2 2x3 4x5 4x3 3x1 4x1 4x2 4x4 5x1 1x4 1x5 5x3 3x1

output:

7

result:

ok single line: '7'

Test #18:

score: 0
Accepted
time: 1ms
memory: 4072kb

input:

20 81
2x3 2x5 5x3 2x1 3x1 5x2 4x5 2x1 1x5 5x2 2x5 1x5 3x2 1x5 1x2 4x2 4x2 5x4 3x2 3x3

output:

2

result:

ok single line: '2'

Test #19:

score: 0
Accepted
time: 1438ms
memory: 160844kb

input:

47 297
3x5 3x2 1x5 5x6 5x5 5x5 4x2 5x4 4x1 6x2 6x6 5x3 1x2 2x6 6x2 3x3 2x2 2x2 1x4 2x5 5x3 4x4 6x3 3x6 5x4 3x6 3x1 6x1 3x1 1x2 3x4 1x6 6x6 5x3 1x1 5x5 2x1 1x4 5x1 5x6 2x1 4x6 2x2 6x6 2x3 6x1 3x1

output:

9

result:

ok single line: '9'

Test #20:

score: 0
Accepted
time: 1439ms
memory: 162400kb

input:

33 197
1x5 2x1 3x6 2x1 5x5 1x4 2x2 2x6 2x4 6x3 2x1 1x3 6x5 6x1 3x2 3x3 4x3 4x6 6x6 6x1 5x2 5x2 1x6 4x4 6x2 2x1 6x5 1x5 2x1 5x6 2x3 3x6 3x5

output:

9

result:

ok single line: '9'

Test #21:

score: 0
Accepted
time: 3ms
memory: 4364kb

input:

29 458
5x6 6x6 6x6 5x6 6x6 5x6 6x6 6x5 6x5 6x6 6x5 6x6 6x5 6x6 6x6 6x6 6x5 5x6 5x5 6x6 6x5 5x5 5x5 6x5 5x6 6x6 6x5 5x5 6x5

output:

1

result:

ok single line: '1'

Test #22:

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

input:

29 142
1x1 5x1 3x5 1x3 5x2 2x4 1x4 1x4 5x5 4x2 1x2 5x1 5x2 2x1 5x3 2x5 4x3 3x2 4x4 2x1 1x4 6x6 1x5 5x4 2x4 3x4 4x4 5x3 1x5

output:

5

result:

ok single line: '5'

Test #23:

score: 0
Accepted
time: 1285ms
memory: 131552kb

input:

29 187
6x1 5x4 4x3 6x3 2x3 2x3 1x3 6x2 4x4 5x6 6x4 3x5 5x1 6x5 5x2 5x3 5x6 5x6 1x3 2x5 3x5 2x1 2x5 1x5 1x4 3x1 4x2 2x3 4x5

output:

7

result:

ok single line: '7'

Test #24:

score: 0
Accepted
time: 1407ms
memory: 155212kb

input:

30 180
3x6 1x2 2x5 1x1 1x1 6x3 3x3 4x1 2x3 2x6 3x5 3x6 4x1 3x3 6x5 4x2 6x4 5x4 6x6 3x2 4x4 1x5 4x3 4x4 2x4 3x4 2x5 1x6 3x3 5x3

output:

8

result:

ok single line: '8'

Test #25:

score: 0
Accepted
time: 436ms
memory: 58684kb

input:

23 151
3x6 5x3 1x1 2x5 1x5 6x5 4x4 3x4 2x3 3x1 1x1 6x6 2x3 6x6 2x6 2x2 3x3 3x2 6x4 3x4 2x1 4x5 6x3

output:

5

result:

ok single line: '5'

Test #26:

score: 0
Accepted
time: 1300ms
memory: 141760kb

input:

21 149
1x4 4x6 5x5 4x6 4x1 5x3 6x2 4x4 3x5 6x3 2x4 3x3 6x6 3x2 1x2 5x3 6x5 6x4 1x1 2x2 6x1

output:

9

result:

ok single line: '9'

Test #27:

score: 0
Accepted
time: 1412ms
memory: 160852kb

input:

50 330
4x2 5x4 6x2 4x4 2x3 6x6 5x3 5x6 3x3 5x1 5x2 4x3 1x3 5x4 2x6 1x6 3x6 6x4 6x6 1x6 4x6 1x3 4x5 6x6 1x1 1x1 3x4 3x5 1x1 2x4 1x3 2x1 3x5 1x5 2x4 1x5 6x4 3x6 2x6 1x5 1x6 6x6 1x3 6x1 5x6 6x6 3x2 1x5 6x1 2x2

output:

8

result:

ok single line: '8'

Test #28:

score: 0
Accepted
time: 1445ms
memory: 145736kb

input:

39 250
5x6 6x4 1x1 3x1 6x1 5x3 2x6 4x4 6x1 1x4 6x6 4x5 3x6 4x2 5x6 4x3 2x4 5x1 6x3 5x6 3x5 4x5 6x5 2x2 5x1 6x6 3x3 5x3 4x1 6x4 2x2 1x5 2x2 2x1 2x1 1x2 1x3 2x5 4x1

output:

7

result:

ok single line: '7'

Test #29:

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

input:

50 889
5x5 6x6 6x6 6x6 6x6 6x6 6x6 6x6 6x6 6x6 6x6 5x5 6x6 6x6 6x6 6x6 6x6 6x6 6x6 6x6 6x6 6x6 6x6 6x6 6x6 6x6 6x6 6x6 6x6 6x6 6x6 6x6 6x6 6x6 6x6 6x6 6x6 6x6 6x6 6x6 6x6 6x6 6x6 6x6 6x6 6x6 6x6 6x6 6x6 6x6

output:

0

result:

ok single line: '0'

Test #30:

score: 0
Accepted
time: 9ms
memory: 5960kb

input:

4 31
2x2 2x5 4x3 6x6

output:

4

result:

ok single line: '4'

Test #31:

score: 0
Accepted
time: 26ms
memory: 8340kb

input:

14 85
1x1 6x5 1x6 4x6 5x6 1x5 5x5 4x3 4x3 1x3 3x3 1x4 2x4 1x1

output:

4

result:

ok single line: '4'

Test #32:

score: 0
Accepted
time: 368ms
memory: 48976kb

input:

27 174
6x2 6x1 3x5 3x3 1x4 5x6 5x4 3x2 3x1 1x6 4x4 6x5 4x1 4x4 3x6 2x4 4x6 6x6 6x6 5x2 4x2 1x6 1x2 1x3 1x2 3x4 1x6

output:

5

result:

ok single line: '5'

Test #33:

score: 0
Accepted
time: 10ms
memory: 5504kb

input:

25 138
4x6 3x4 1x3 4x4 3x1 3x4 5x2 1x1 5x3 1x6 6x4 6x3 2x1 5x2 1x6 1x6 4x2 4x6 6x2 4x6 3x1 5x1 6x2 1x5 3x5

output:

3

result:

ok single line: '3'

Test #34:

score: 0
Accepted
time: 92ms
memory: 18968kb

input:

50 269
2x6 4x3 2x4 2x4 3x1 2x1 5x6 2x6 3x6 6x1 3x3 4x6 1x6 2x5 6x6 1x2 2x3 1x5 5x3 5x6 3x1 2x3 3x4 6x3 4x2 3x2 4x3 3x6 1x2 2x2 2x3 3x4 2x6 1x5 2x4 5x3 6x3 6x4 1x2 1x6 1x5 1x5 1x4 6x5 4x3 3x4 2x5 1x3 3x1 1x3

output:

4

result:

ok single line: '4'

Test #35:

score: 0
Accepted
time: 96ms
memory: 19884kb

input:

46 260
6x5 1x6 2x4 5x1 5x6 4x4 1x4 5x3 2x6 3x2 1x5 1x2 3x2 4x3 5x1 5x1 6x2 1x6 6x2 5x6 2x2 3x1 4x2 4x1 5x6 1x6 6x1 6x4 4x4 6x1 3x4 2x2 3x1 2x6 2x3 2x3 3x1 2x1 5x4 6x5 3x6 6x5 3x4 6x2 2x5 6x1

output:

4

result:

ok single line: '4'

Test #36:

score: 0
Accepted
time: 279ms
memory: 41320kb

input:

41 194
2x1 1x5 3x1 2x1 6x5 1x5 5x3 6x1 5x2 1x5 1x5 6x3 2x1 1x2 3x2 3x6 6x5 5x2 4x5 2x4 6x1 5x1 3x1 2x3 5x3 5x5 1x2 4x2 4x2 2x2 5x3 1x3 5x3 4x6 3x2 4x1 6x3 3x3 4x1 4x1 1x2

output:

5

result:

ok single line: '5'

Test #37:

score: 0
Accepted
time: 484ms
memory: 60368kb

input:

43 242
6x3 3x5 1x2 5x4 2x6 1x6 2x4 1x6 3x2 2x5 2x1 3x1 4x1 3x5 6x3 3x6 6x4 1x2 2x1 2x3 6x3 4x6 5x4 5x3 3x5 1x5 1x3 1x1 4x4 2x2 4x6 1x2 2x2 2x5 3x2 5x6 2x3 6x3 5x5 1x4 6x5 2x2 1x3

output:

5

result:

ok single line: '5'

Test #38:

score: 0
Accepted
time: 7ms
memory: 4892kb

input:

5 29
1x5 2x5 3x3 2x3 6x5

output:

3

result:

ok single line: '3'

Test #39:

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

input:

49 230
3x3 4x3 4x6 3x6 4x6 2x3 5x6 1x3 6x6 5x1 1x2 6x6 1x1 1x4 6x6 3x3 2x3 1x2 4x4 5x2 6x3 5x5 1x4 1x4 1x1 6x3 4x6 5x1 6x5 5x6 1x6 1x6 1x3 3x3 2x1 6x1 4x5 4x2 6x6 3x1 4x5 2x2 3x4 4x5 3x2 6x1 2x3 6x6 3x6

output:

0

result:

ok single line: '0'

Test #40:

score: 0
Accepted
time: 103ms
memory: 20684kb

input:

45 304
2x4 2x5 6x6 1x5 3x3 2x5 1x6 4x1 5x5 2x2 5x3 5x1 6x6 5x4 6x5 6x5 1x5 2x3 6x4 4x3 1x2 6x1 1x5 6x2 1x5 5x2 4x3 6x1 4x5 2x5 6x4 2x6 5x5 6x5 3x1 5x6 3x3 3x2 4x4 6x3 6x4 1x6 3x3 4x6 1x6

output:

4

result:

ok single line: '4'

Test #41:

score: 0
Accepted
time: 101ms
memory: 19108kb

input:

44 278
2x3 6x2 6x6 6x1 3x3 3x5 1x6 3x3 1x4 5x2 3x3 3x4 2x5 6x3 2x5 2x6 5x1 6x2 5x6 5x6 4x2 6x1 1x6 1x2 1x1 1x1 4x6 4x3 4x3 6x3 2x1 1x6 5x3 4x3 6x4 5x6 4x1 5x6 4x4 3x4 6x6 4x1 5x2 5x6

output:

4

result:

ok single line: '4'

Test #42:

score: 0
Accepted
time: 3ms
memory: 4220kb

input:

48 261
4x4 1x2 2x4 6x3 3x3 6x5 5x1 5x3 1x3 5x6 1x5 4x6 6x4 3x5 6x5 5x3 2x5 4x5 3x6 2x5 2x2 2x6 4x2 2x6 2x6 6x5 6x4 5x1 3x3 4x2 2x6 6x2 4x4 4x4 3x3 4x1 1x5 1x5 4x1 1x4 4x2 2x2 1x3 5x3 3x4 2x4 5x4 3x5

output:

1

result:

ok single line: '1'

Test #43:

score: 0
Accepted
time: 5ms
memory: 4908kb

input:

40 260
3x5 5x6 1x5 6x4 2x2 1x2 5x1 3x5 2x4 1x6 3x6 6x5 4x2 6x5 4x5 1x5 5x3 6x4 4x5 2x2 4x1 2x4 2x4 6x1 5x6 6x6 6x3 6x6 6x1 4x2 5x5 3x2 3x3 4x6 2x2 4x2 6x4 4x3 4x2 3x1

output:

2

result:

ok single line: '2'

Test #44:

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

input:

1 1
1x3

output:

2

result:

ok single line: '2'

Test #45:

score: 0
Accepted
time: 1442ms
memory: 154596kb

input:

49 324
4x3 1x6 1x5 1x5 5x4 4x5 6x5 1x2 5x6 4x1 2x2 4x6 6x5 5x5 4x2 5x2 4x6 1x5 5x3 1x6 5x1 3x5 5x1 6x4 6x3 2x3 1x2 4x6 5x5 1x5 1x6 2x4 6x1 3x3 4x4 3x4 5x4 6x1 5x6 4x6 6x1 4x2 1x6 3x5 5x1 1x2 2x4 6x6 3x4

output:

8

result:

ok single line: '8'

Test #46:

score: -100
Wrong Answer
time: 1489ms
memory: 164004kb

input:

40 222
1x3 4x1 3x3 1x3 4x5 3x2 1x3 2x2 3x6 5x2 2x3 1x3 2x1 6x3 1x4 5x4 2x5 4x2 1x4 1x2 5x4 1x4 6x4 5x2 6x6 4x4 1x1 6x1 5x3 4x2 6x5 6x3 3x5 4x5 1x5 3x4 6x2 5x4 3x5 4x3

output:


result:

wrong answer 1st lines differ - expected: '6', found: ''