same thing here! it works fine locally for the input samples but i get this
RE on test set 1
Em segunda-feira, 30 de março de 2020 02:31:31 UTC+2, Karim Elghamry
escreveu:
>
> #include <iostream>
> #include <string>
> #include <vector>
> #include <utility>
> #include <map>
> #include <cmath>
>
> 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++)
> {
> 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 < sqrt(n); i = i + 2)
> {
> if (n % i == 0)
> {
> temp.first = i;
> temp.second = n / i;
> return temp;
> }
> }
>
> return temp;
> }
>
> It runs fine for the input samples but gives RE on test set 1, 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/fa205475-6a6d-4206-9b9f-621c3245c7f7%40googlegroups.com.