就用了一个vector,也MLE吗

P1319 压缩技术

hdh1103 @ 2024-03-16 15:55:04

#include <iostream>
#include<string>
#include<sstream>
#include<algorithm>
#include <math.h>
#include <set>
#include <map>
#include <vector>
#include <set>
#include <queue>
//#include <unordered_set>
#define ll long long
using namespace std;
#include<cstdio>

int main()
{

    int n;
    cin>>n;
    vector<int> a;

    vector<int> v;
    while(1)
    {
        ll sum;
        cin>>sum;
        a.push_back(sum);
        //  cin>>a[index];
        if(cin.get()=='\n')
        {
            break;
        }

    }

    ll index =0;
  //  cout<<n;
    for(ll i=0; i<a.size(); i++)
    {
        ll wz = a[i];
       // cout<<"*"<<wz<<" ";
        for(ll j=1; j<=wz; j++)
        {
            if((i+1)%2==0)
            {
                cout<<1;
            }
            else
            {
                cout<<0;
            }
            index++;
            if(index%n==0)
            {
                cout<<endl;
                index=0;
            }
        }

    }

    return 0;
}

|