ZCO practice server INOI 2013 problem SequenceLand

Can anyone point out what’s wrong with my code:

#include <cstdio>
#include <set>
#include <vector>
#include <algorithm>
using namespace std;
vector<int> inp,ins,p,q;
vector<int>::iterator mn;
int main(){
    freopen(".in","r",stdin);
    freopen(".out","w",stdout);
    int n,k,m,l,c=0;
    scanf("%d %d",&n,&k);
    scanf("%d",&m);
    for(int j=0;j<m;j++){
        scanf("%d",&l);
        p.push_back(l);
    }
    sort(p.begin(),p.end());
    for(int i=1;i<n;i++){
        scanf("%d",&m);
        for(int j=0;j<m;j++){
            scanf("%d",&l);
            inp.push_back(l);
        }
        sort(inp.begin(),inp.end());
        mn=set_intersection(inp.begin(),inp.end(),p.begin(),p.end(),ins.begin());
        if((int)ins.size()>=k){
            c++;
            mn=set_union(p.begin(),p.end(),ins.begin(),ins.end(),q.begin());
            p.assign(q.begin(),q.end());
            sort(p.begin(),p.end());
        }
        ins.clear();
        inp.clear();
        q.clear();
    }
    printf("%d",c);
    return 0;
}

Sorry I can’t help you fix your code tonight but you can compare with my code if you wish: http://pastebin.com/5SPS1vW1

1 Like

@superty thanks. I wish you could be there with me tomorrow to help me while coding :wink: