- Quiz
- AC
- Solution
- editorial's solution : add each element to lowest
- my solution : sort array and put it in order i%M
void solve(){ ll N,M,X; cin>>N>>M>>X; VI A(N); rep(i, N)cin >> A[i]; vector<PII> V; rep(i,N){ V.emplace_back(A[i],i); } sort(ALL(V)); VI Ans(N,-1); rep(i,N){ ll idx = V[i].second; Ans[idx]=i%M; } p_yes(); print_vector(Ans,1); } int main(){ cin.tie(0); ios::sync_with_stdio(false); // input ll N;cin>>N; while(N--)solve(); return 0; }