```
#include <iostream>
#include <string>
#include <vector>
#include <utility>
#include <map>
std::pair<int, int> primeFac(int n);
int main()
{
int t, l, n, k = 1;
std::vector<int> input, primes;
std::map<int, char> sortedPrimes;
std::string output;
std::cin >> t;
while (t--)
{
std::cin >> n >> l;
input.clear();
primes.clear();
sortedPrimes.clear();
output = "";
for (int i = 0; i < l; i++)
{
int temp;
std::cin >> temp;
input.push_back(temp);
}
std::pair<int, int> eminem = primeFac(input[0]);
int first = input[1] % eminem.first == 0 ? eminem.second :
eminem.first;
int second = first == eminem.first ? eminem.second : eminem.first;
primes.push_back(first);
sortedPrimes[first] = 'a';
primes.push_back(second);
sortedPrimes[second] = 'a';
for (int i = 1; i < l; i++)
{
if (primes[i] == 0)
primes[i] == 1;
int temp = input[i] / primes[i];
primes.push_back(temp);
sortedPrimes[temp] = 'a';
}
int i = 0;
for (auto &c : sortedPrimes)
{
c.second = 'A' + i;
i++;
}
for (auto c : primes)
{
output += sortedPrimes[c];
}
std::cout << "Case #" << k << ": " << output << std::endl;
k++;
}
return 0;
}
std::pair<int, int> primeFac(int n)
{
std::pair<int, int> temp;
for (int i = 3; i < n; i = i + 2)
{
if (n % i == 0)
{
temp.first = i;
temp.second = n / i;
return temp;
}
}
return temp;
}
```
the code passes the given two sample test cases, but gives RE, why?
--
You received this message because you are subscribed to the Google Groups
"Google Code Jam" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/google-code/63f9fbef-3494-4b81-b5ca-d27230566f04%40googlegroups.com.