171972025-06-02 20:19:45tomi7Bináris kereséscpp17Wrong answer 7/10028ms1504 KiB
// Source: https://usaco.guide/general/io

#include <bits/stdc++.h>
using namespace std;

int main() {
	int t;cin>>t;
    while(t--){
        int n;cin>>n;
        string s;
        cin>>s;
        vector<int> nulla;
        vector<int> egy;
        for(int i=0;i<n;i++){
            if(s[i]=='0'){
                nulla.push_back(i+1);
            }else{
                egy.push_back(i+1);
            }
        }
        reverse(nulla.begin(), nulla.end());
        for(int x: egy){
            cout<<x<<' ';
        }
        for(int x: nulla){
            cout<<x<<' ';
        }
        cout<<endl;
    }
}
SubtaskSumTestVerdictTimeMemory
subtask13/3
1Accepted13ms1504 KiB
subtask24/4
1Accepted13ms1212 KiB
subtask30/16
1Wrong answer1ms316 KiB
subtask40/25
1Wrong answer28ms564 KiB
2Wrong answer28ms564 KiB
3Wrong answer28ms564 KiB
4Wrong answer28ms564 KiB
5Wrong answer25ms756 KiB
subtask50/22
1Wrong answer9ms1396 KiB
2Wrong answer9ms1200 KiB
3Wrong answer9ms1200 KiB
subtask60/30
1Wrong answer13ms820 KiB
2Wrong answer10ms896 KiB