Submission #113198

# Submission time Handle Problem Language Result Execution time Memory
113198 2019-05-24T09:17:53 Z davitmarg Bowling (BOI15_bow) C++17
0 / 100
2 ms 384 KB
/*DavitMarg*/
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <string>
#include <cstring>
#include <map>
#include <set>
#include <queue>
#include <iomanip>
#include <bitset>
#include <stack>
#include <cassert>
#include <iterator>
#include <ctype.h>
#include <fstream>
#define mod 1000000007ll
#define LL long long
#define LD long double
#define MP make_pair
#define PB push_back
#define all(v) v.begin (),v.end()
using namespace std;

int t, n,a[15],sum[15];
LL ans;
char tmp;
int main()
{
	cin >> t;
	while (t--)
	{
		scanf("%d", &n);
		ans = 1;
		n *= 2;
		for (int i = 1; i <= n; i++)
		{
			scanf(" %c",&tmp);
			a[i] = tmp - '0';
			if (tmp == '?')
				a[i] = -1;
		}
		scanf(" %c", &tmp);
		for (int i = 2; i <= n; i += 2)
			scanf("%d", sum + i);
		for (int i = 2; i <= n; i += 2)
		{
			if (sum[i] >= 10)
				ans = 0;
			if (sum[i] == -1 )
			{
				if (min(a[i - 1], a[i]) != -1)
				{
					sum[i] = a[i - 1] + a[i];
					continue;
				}
				else if(a[i-1]==a[i])
					ans *= (LL)(10+9+8+7+6+5+4+3+2+1);
				else
				{
					LL x = max(a[i - 1], a[i]);
					ans *= 10ll - x;
				}
			}
			else
			{
				if (min(a[i - 1], a[i]) != -1)
					ans *= (a[i - 1] + a[i] == sum[i]);
				else if (a[i - 1] == a[i])
					ans *= (sum[i]+1);
				else
				{
					LL x = max(a[i - 1], a[i]);
					ans *= (x <= sum[i]);
				}
			}
		}
		printf("%lld\n",ans);
	}
	return 0;
}

/*



*/

Compilation message

bow.cpp: In function 'int main()':
bow.cpp:34:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d", &n);
   ~~~~~^~~~~~~~~~
bow.cpp:39:9: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
    scanf(" %c",&tmp);
    ~~~~~^~~~~~~~~~~~
bow.cpp:44:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf(" %c", &tmp);
   ~~~~~^~~~~~~~~~~~~
bow.cpp:46:9: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
    scanf("%d", sum + i);
    ~~~~~^~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 256 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 256 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 256 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -