UNITGCD WHY IS THIS WRONG

#include <iostream>
#include<cmath>
#include <map>
#include <vector>
using namespace std;

int main() {
    int t;std::cin >> t;
    int n;std::cin >> n;
    int arr[n+1];
    for(int i=0 ; i<=n ; i++)arr[i]=1;
    for(int i=2 ; i<=sqrt(n) ; i++){
        if(arr[i]==1){
            for(int j=2*i ; j<=n ; j+=i){
                if(arr[j]==1){
                int k=j/i;
                arr[j]=j/i;}
            }
        }
    }
    /*for(int i=0 ; i<n ; i++){
        cout<<arr[i]<<" ";
    }cout<<endl;*/
    multimap<int,int>tej ;
    int max=-1;
    for(int i=1 ; i<=n ; i++){
        tej.insert(make_pair(arr[i],i));
        //tej[arr[i]]=i;
        if(max<arr[i]){
            max=arr[i];
        }
    }
    std::cout << max << std::endl;
    int current =1;
    std::vector<int>hello;
    for(auto it=tej.begin() ; it!=tej.end() ; it++){
        if(it->first!=current){
            cout<<hello.size()<<" ";
            for(int i=0 ; i<hello.size() ; i++){
                cout<<hello[i]<<" ";
            }
            cout<<"\n";
            hello.clear();
            current++;
        }
        
        hello.push_back(it->second);
    }
        cout<<hello.size()<<" ";
            for(int i=0 ; i<hello.size() ; i++){
                cout<<hello[i]<<" ";
            }
            cout<<"\n";

	return 0;
}

HEY i did this but its giving wrong answer… could any one plz, tell which test case i am missing
plx
zzzzz

format your code ``` before and after code

1 Like

:smile:

by the way its not python /* */ isfor comments in c++

? , format your code not comment .

1 Like

Please either format your code or (better!) link to your submission - the forum software has mangled it and it won’t compile! :slight_smile:

N = 10
5
5 1 2 3 5 7 
1 4 
2 6 9 
1 8 
1 10 

for N=10, this is your answer
6 and 9 are not co-primes.

i need to work on logic :pensive:
thanks

ok ok , i wasnt knowing what formatting is
thanks