Submission #1869805


Source Code Expand

#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back

const int maxn = 2e5 + 20;

int n;
string s, t, nums[maxn], numt[maxn];
vector<string> ans;

int main()
{
	ios::sync_with_stdio(0); cin.tie(0);
	cin >> n >> s >> t;
	if (s > t)
		swap (s, t);
	int ss = s.size(), tt = t.size();

	for (int i = 1; i * ss <= n; i++)
		nums[i] = nums[i-1] + s;
	for (int i = 1; i * tt <= n; i++)
		numt[i] = numt[i-1] + t;

	for (int i = 0; i * ss <= n; i++)
		if ( (n - i * ss) % tt == 0)
			ans.pb(nums[i] + numt[ (n - i*ss) / tt ] );
	cout << *min_element (ans.begin(), ans.end()) << endl;
	return 0;
}

Submission Info

Submission Time
Task G - Coinage
User mahan_sh
Language C++14 (GCC 5.4.1)
Score 0
Code Size 651 Byte
Status RE
Exec Time 3650 ms
Memory 1883252 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 100
Status
AC × 4
AC × 18
WA × 1
TLE × 22
MLE × 1
RE × 12
Set Name Test Cases
Sample a01, a02, a03, a04
All a01, a02, a03, a04, b05, b06, b07, b08, b09, b10, b11, b12, b13, b14, b15, b16, b17, b18, b19, b20, b21, b22, b23, b24, b25, b26, b27, b28, b29, b30, b31, b32, b33, b34, b35, b36, b37, b38, b39, b40, b41, b42, b43, b44, b45, b46, b47, b48, b49, b50, b51, b52, b53, b54
Case Name Status Exec Time Memory
a01 AC 3 ms 3328 KB
a02 AC 3 ms 3328 KB
a03 AC 3 ms 3328 KB
a04 AC 3 ms 3328 KB
b05 AC 3 ms 3328 KB
b06 AC 5 ms 4628 KB
b07 TLE 2913 ms -601740 KB
b08 TLE 2523 ms -601880 KB
b09 RE 1962 ms -601692 KB
b10 AC 13 ms 5896 KB
b11 AC 4 ms 4372 KB
b12 AC 4 ms 4568 KB
b13 RE 1869 ms -601564 KB
b14 RE 1956 ms -601640 KB
b15 RE 1965 ms -601712 KB
b16 TLE 2411 ms -601528 KB
b17 TLE 2480 ms -601864 KB
b18 TLE 2518 ms -601608 KB
b19 TLE 2493 ms -601620 KB
b20 TLE 2458 ms -601444 KB
b21 TLE 2692 ms -601612 KB
b22 TLE 3441 ms -601888 KB
b23 TLE 2605 ms -601908 KB
b24 RE 1913 ms -601752 KB
b25 RE 1989 ms -602224 KB
b26 RE 1936 ms -602152 KB
b27 TLE 2496 ms -601784 KB
b28 TLE 2425 ms -601632 KB
b29 RE 1962 ms -601988 KB
b30 RE 1922 ms -604664 KB
b31 RE 1981 ms -574008 KB
b32 TLE 3650 ms -573892 KB
b33 TLE 2465 ms -574232 KB
b34 TLE 2502 ms -574368 KB
b35 TLE 2492 ms -574192 KB
b36 TLE 3532 ms -574076 KB
b37 TLE 2520 ms -574092 KB
b38 TLE 2838 ms -574060 KB
b39 MLE 970 ms 1883252 KB
b40 WA 4 ms 4736 KB
b41 AC 71 ms 132736 KB
b42 TLE 2526 ms -573860 KB
b43 TLE 3500 ms -573824 KB
b44 RE 2001 ms -574044 KB
b45 TLE 2502 ms -573764 KB
b46 AC 12 ms 6152 KB
b47 AC 4 ms 4568 KB
b48 AC 4 ms 4372 KB
b49 AC 4 ms 4372 KB
b50 RE 2084 ms -574320 KB
b51 AC 96 ms 168820 KB
b52 AC 5 ms 7168 KB
b53 AC 4 ms 4432 KB
b54 AC 50 ms 92672 KB