Problems

# Divide into 2 groups

published at 12/27/22, 12:49:13 pm

this one for 50 minutes

published at 12/27/22, 7:41:55 pm

# include <bits/stdc++.h>

using namespace std;

# define ll long long

int main() { long x,y,say=0,z=0,k=0,f=0; vector<int>v11,v22; vector<string>s; cin>>x; if(x==2) { cout<<"1 1"<<endl; cout<<1<<endl<<2; return 0; } if(x%2==0) { for(int i=0;i<x;i++) { z=z+1; if(i%2==0) { if(k%2==0) { v11.push_back(z); } else { v22.push_back(z); } k=k+1; } else { if(f%2==0) { v22.push_back(z); } else { v11.push_back(z); } f=f+1;

        }

}
}
else
{
v11.push_back(1);
v11.push_back(2);
v22.push_back(3);
z=3;
for(int i=0;i<x-3;i++)
{
z=z+1;
if(i%2==0)
{
if(k%2==0)
{
v11.push_back(z);
}
else
{
v22.push_back(z);
}
k=k+1;
}
else
{
if(f%2==0)
{
v22.push_back(z);
}
else
{
v11.push_back(z);
}
f=f+1;

}

}
}
cout<<v11.size()<<" "<<v22.size();
cout<<endl;
for(int i=0;i<v11.size();i++)
{
cout<<v11[i]<<" ";
}
cout<<endl;
for(int i=0;i<v22.size();i++)
{
cout<<v22[i]<<" ";
}
cout<<endl;

return 0;


}

published at 1/3/23, 8:43:14 am

# include <bits/stdc++.h>

using namespace std;

int main() {

int n; cin>>n; if(n==1) { cout<<1<<" "<<1<<endl<<1<<" "<<2; return 0; }

vector<int>v; vector<int>v1; int eded=0,say=0,is1=0; int is=0; if(n%2==0) { for(int i= 0 ;i<n; i++) { eded++;

 if(i%2==0)
{
if(is%2==0)
{
v.push_back(eded);
}
else
{
v1.push_back(eded);
}
is++;
}
else
{
if(is1%2==0)
{
v1.push_back(eded);
}
else
{
v.push_back(eded);
}
is1++;
}


} } else { v.push_back(1); v.push_back(2); v1.push_back(3); eded=3; for(int i= 0 ;i<n-3; i++) { eded++;

 if(i%2==0)
{
if(is%2==0)
{
v.push_back(eded);
}
else
{
v1.push_back(eded);
}
is++;
}
else
{
if(is1%2==0)
{
v1.push_back(eded);
}
else
{
v.push_back(eded);
}
is1++;
}


}

}

cout<<v.size()<<" "<<v1.size()<<endl; for(int i= 0 ; i<v.size(); i++) cout<<v[i]<<" "; cout<<endl; for(int j=0 ; j<v1.size() ; j++) cout<<v1[j]<<" "; }

published at 1/12/23, 1:57:19 pm

eolymp MəsələlərNövbəYarışlarDərəcəQruplarMəqalələrFond   Məsələlər İki qrupa ayırın Şərt Həllər Statistikalar Müzakirə 

xCefer008 dərc olunub 27.12.22 10:49:13 this one for 50 minutes

Omar64 dərc olunub 27.12.22 17:41:55 include <bits/stdc++.h> using namespace std;

define ll long long int main() { long x,y,say=0,z=0,k=0,f=0; vector<int>v11,v22; vector<string>s; cin>>x; if(x==2) { cout<<"1 1"<<endl; cout<<1<<endl<<2; return 0; } if(x%2==0) { for(int i=0;i<x;i++) { z=z+1; if(i%2==0) { if(k%2==0) { v11.push_back(z); } else { v22.push_back(z); } k=k+1; } else { if(f%2==0) { v22.push_back(z); } else { v11.push_back(z); } f=f+1;

    }

}


} else { v11.push_back(1); v11.push_back(2); v22.push_back(3); z=3; for(int i=0;i<x-3;i++) { z=z+1; if(i%2==0) { if(k%2==0) { v11.push_back(z); } else { v22.push_back(z); } k=k+1; } else { if(f%2==0) { v22.push_back(z); } else { v11.push_back(z); } f=f+1;

    }

}


} cout<<v11.size()<<" "<<v22.size(); cout<<endl; for(int i=0;i<v11.size();i++) { cout<<v11[i]<<" "; } cout<<endl; for(int i=0;i<v22.size();i++) { cout<<v22[i]<<" "; } cout<<endl;

return 0; }

RuslanImanov dərc olunub 03.01.23 06:43:14 include <bits/stdc++.h> using namespace std;

int main() {

int n; cin>>n; if(n==1) { cout<<1<<" "<<1<<endl<<1<<" "<<2; return 0; }

vector<int>v; vector<int>v1; int eded=0,say=0,is1=0; int is=0; if(n%2==0) { for(int i= 0 ;i<n; i++) { eded++;

if(i%2==0) { if(is%2==0) { v.push_back(eded); } else { v1.push_back(eded); } is++; } else { if(is1%2==0) { v1.push_back(eded); } else { v.push_back(eded); } is1++; } } } else { v.push_back(1); v.push_back(2); v1.push_back(3); eded=3; for(int i= 0 ;i<n-3; i++) { eded++;

if(i%2==0) { if(is%2==0) { v.push_back(eded); } else { v1.push_back(eded); } is++; } else { if(is1%2==0) { v1.push_back(eded); } else { v.push_back(eded); } is1++; } }

}

cout<<v.size()<<" "<<v1.size()<<endl; for(int i= 0 ; i<v.size(); i++) cout<<v[i]<<" "; cout<<endl; for(int j=0 ; j<v1.size() ; j++) cout<<v1[j]<<" "; }

published at 1/18/23, 2:32:42 pm

bunu yazmiyanda ne bilim

published at 6/28/23, 5:10:36 pm

# include <bits/stdc++.h>

using namespace std;

# define pb push_back

int main() { int x,y,maxi=0,say=0,z=0,k=0,f=0; string a,b,c; vector<int>v1,v2; vector<string>s; cin>>x; if(x==2) { cout<<"1 1"<<endl; cout<<1<<endl<<2; return 0; } if(x%2==0) { for(int i=0;i<x;i++) { z=z+1; if(i%2==0) { if(k%2==0) { v1.pb(z); } else { v2.pb(z); } k=k+1; } else { if(f%2==0) { v2.pb(z); } else { v1.pb(z); } f=f+1;

        }

}
}
else
{
v1.pb(1);
v1.pb(2);
v2.pb(3);
z=3;
for(int i=0;i<x-3;i++)
{
z=z+1;
if(i%2==0)
{
if(k%2==0)
{
v1.pb(z);
}
else
{
v2.pb(z);
}
k=k+1;
}
else
{
if(f%2==0)
{
v2.pb(z);
}
else
{
v1.pb(z);
}
f=f+1;

}

}
}
cout<<v1.size()<<" "<<v2.size();
cout<<endl;
for(int i=0;i<v1.size();i++)
{
cout<<v1[i]<<" ";
}
cout<<endl;
for(int i=0;i<v2.size();i++)
{
cout<<v2[i]<<" ";
}
cout<<endl;

return 0;


}