Runs for -1 ms : A dream come true or a nightmare?

I submitted this code recently to Contest Page | CodeChef

#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
#include <cmath>
#include <set>
#include <queue>

#define ll long long
using namespace std;
using namespace std;
void print(vector<int> v){
    for(int i: v) cout << i << " ";
    cout << endl;
}
vector<int> set_to_vector(set<int> s){
    vector<int> v;
    for(int i: s) v.push_back(i);
    return v;
}
vector<int> cur;
int cntr = 0;
int n;
int query(vector<int> q){
    cntr++;
    cout << "? ";
    cout << q.size() << " ";
    for(int i: q){
        cout << i + 1 << " ";
    }
    int x;
    cin >> x;
    return x;
}
int binSearch(int l, int r, int ind){
    if(l == r){
        return l;
    }
    int m = (l + r)/2;
    set<int> cur1;
    for(int i = l; i <= m; i++){
        cur1.insert(cur[i]);
    }
    cur1.insert(ind);
    if(query(set_to_vector(cur1)) == 2){
        cntr++;
        return binSearch(l, m, ind);
    }else{
        return binSearch(m + 1, r, ind);
    }
}

int main() {
    int t;
    cin >> t;
    while(t--) {
        cur.clear();
        cin >> n;
        int q;
        cin >> q;
        vector<int> res;
        for (int i = 0; i < n; i++) {
            vector<int> dum = cur;
            dum.push_back(i);
            if (query(dum) == 1) {
                cur.push_back(i);
                res.push_back(cur.size());
            } else {
                res.push_back(binSearch(0, cur.size() - 1, i) + 1);
            }
        }
        cout << "! ";
        print(res);
    }
}

HOWEVER, for some very strange reason, it tells me that my code takes -1ms to run & it gives a wrong answer… why?

See more here: Solution: 50195222 | CodeChef

After every query you are required to print “\n” and flush the output , -1 ms is called due to idleness I think .