My issue
Why it show Runtime Error ?
My code
#include <iostream>
#include <bits/stdc++.h>
#include <vector>
#include <algorithm>
using namespace std;
int main() {
// your code goes here
int t;
std::cin >> t;
while(t--)
{
int n;
std::cin >> n;
int *a=new int[n];
for(int i=0;i<n;i++)
{
cin>>a[i];
}
sort(a, a+n);
vector<int>v;
for(int i=0;i<n-1;i++)
{
if(a[i]<a[i+1])
{
v.push_back(n-i-1);
}
else
v.push_back(0);
}
for(int i=0;i<n;i++)
{
cout<<v[i]<< " ";
}
cout<<endl;
}
return 0;
}
Problem Link: BIT2A Problem - CodeChef