text stringlengths 49 983k |
|---|
#include<iostream>
#include<cstdio>
#include<set>
using namespace std;
int a,b,c;
multiset<string> s;
int main(){
scanf("%d%d%d",&a,&b,&c);
while (a--) s.insert("a");
while (b--) s.insert("b");
while (c--) s.insert("c");
while (s.size()>1){
string ns=*s.begin()+*s.rbegin();
s.erase(s.begin());
s.erase(s.fin... |
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define INF (1LL << 55)
#define MOD (1000 * 1000 * 1000 + 7)
#define maxn 1000111
typedef long long ll;
typedef long double ld;
vector<string> v;
int main(){
int a, b, c;
cin >> a >> b >> c;... |
#include <bits/stdc++.h>
using namespace std;
inline int read()
{
int x=0,f=1,c=getchar();
while(c<48) c=='-'&&(f=-1),c=getchar();
while(c>47) x=x*10+c-'0',c=getchar();
return x*f;
}
const int MAXN = 300005;
std::multiset<string> s;
int main(int argc, char const *argv[])
{
auto init=[](string t) {for(int i=read... |
#include <bits/stdc++.h>
// iostream is too mainstream
#include <cstdio>
// bitch please
#include <iostream>
#include <algorithm>
#include <cstdlib>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <list>
#include <cmath>
#include <iomanip>
#include <time.h>
#define dibs reserv... |
#include<cstdio>
#include<set>
#include<cstring>
#include<string>
#include<iostream>
using namespace std;
multiset<string> sak;
multiset<string>::iterator it;
int main(){
// freopen("F.in","r",stdin);
int x,y,z;
scanf("%d%d%d",&x,&y,&z);
for(int i=1;i<=x;i++) sak.insert("a");
for(int i=1;i<=y;i++) sak.insert("b");
... |
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<cassert>
#in... |
#include <bits/stdc++.h>
using namespace std;
int x, y, z;
pair<int, int> ans;
string a, b, c;
void calc(int x, int y, int z) {
if (x == 0 && z == 0) {
ans.first = 2, ans.second = y;
return ;
}
if (x == 0 && y == 0) {
ans.first = 3, ans.second = z;
return ;
}
if (y == 0 && z == 0) {
ans.first = 1, ans.... |
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
string solve(int x, int y, int z){
//cout << x << " " << y << " " << z << endl;
if(y == 0 && z == 0){
string ans;
for(int i = 0; i < x; i++) ans += 'a';
return ans;
}
if(x == 0){
string str = solve(y,z,0... |
#include <bits/stdc++.h>
#define rep(i, x, y) for (int i = x; i <= y; i++)
using namespace std;
int x, y, z;
multiset<string> s;
int main() {
cin >> x >> y >> z;
rep(i, 1, x) s.insert("a");
rep(i, 1, y) s.insert("b");
rep(i, 1, z) s.insert("c");
while (s.size() > 1) {
string ss = *s.begin(... |
#include <cstring>
#include <cstdio>
#include <algorithm>
#include <string>
#include <set>
using namespace std;
multiset<string> S;
multiset<string>::iterator itL, itR;
int X, Y, Z;
int main() {
scanf("%d%d%d", &X, &Y, &Z);
while(X--) S.insert("a");
while(Y--) S.insert("b");
while(Z--) S.insert("c");
while(S.siz... |
#include <set>
#include <iostream>
#include <cstdio>
#include <string>
#include <cstring>
using namespace std;
multiset <string> s;
int main()
{
int X,Y,Z;
scanf("%d%d%d",&X,&Y,&Z);
for(int i = 1;i <= X; ++ i)
s.insert("a");
for(int i = 1;i <= Y; ++ i)
s.insert("b");
for(int i = 1;i <= Z; ++ i)
s.insert("... |
#include <stdio.h>
#include <algorithm>
#include <assert.h>
#include <bitset>
#include <cmath>
#include <complex>
#include <deque>
#include <functional>
#include <iostream>
#include <limits.h>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stdlib.h>
#include <string... |
#include<bits/stdc++.h>
using namespace std;
multiset<string > s;
int a,b,c;
int main()
{
scanf("%d%d%d",&a,&b,&c);
while (a--)s.insert("a");
while (b--)s.insert("b");
while (c--)s.insert("c");
while (s.size()>1)
{
string t=*s.begin()+ *--s.end();
s.erase(s.begin());
s.erase(--s.end());
s.insert(t);
... |
#include <cstdio>
#include <set>
#include <iostream>
using std::string;
std::multiset<string> s;
int main() {
int n;
scanf("%d", &n);
for(int i = 1; i <= n; i++) {
s.insert("a");
}
scanf("%d", &n);
for(int i = 1; i <= n; i++) {
s.insert("b");
}
scanf("%d", &n);
for... |
#include<bits/stdc++.h>
using namespace std;
multiset <string> s;
int x,y,z;
int main(){
cin>>x>>y>>z;
while(x--)s.insert("a");
while(y--)s.insert("b");
while(z--)s.insert("c");
while(s.size()>1){
string a=*s.begin();
string b=*s.rbegin();
s.erase(s.begin());
s.erase(--s.end());
s.insert(a+b);
}
cout<<... |
#include<iostream>
#include<algorithm>
using namespace std;
const int maxn=200+2;
int tmp,cnt;
string str[maxn];
int main(){
for (char ch='a';ch<='c';ch++){
cin>>tmp;
while (tmp--) str[cnt++]+=ch;
}
while (cnt>1){
sort(str,str+cnt);
str[0]+=str[--cnt];
}
cout<<str[0];
return 0;
} |
#include<bits/stdc++.h>
using namespace std;
multiset<string> s;
int x,y,z;
int main()
{
cin>>x>>y>>z;
for(int i=1;i<=x;i++) s.insert("a");
for(int i=1;i<=y;i++) s.insert("b");
for(int i=1;i<=z;i++) s.insert("c");
while(s.size()>1)
{
string t=*s.begin()+*--s.end();
s.erase(s.begi... |
#include<bits/stdc++.h>
using namespace std;
int r,b,g;
multiset<string> st;
int main()
{
// freopen("beargguy.in","r",stdin);
// freopen("beargguy.out","w",stdout);
scanf("%d%d%d",&r,&b,&g);
for(int i=1;i<=r;i++) st.insert("a");
for(int i=1;i<=b;i++) st.insert("b");
for(int i=1;i<=g;i++) st.insert("c"... |
#include<set>
#include<cstdio>
#include<cctype>
#include<string>
inline int getint() {
register char ch;
while(!isdigit(ch=getchar()));
register int x=ch^'0';
while(isdigit(ch=getchar())) x=(((x<<2)+x)<<1)+(ch^'0');
return x;
}
int main() {
std::multiset<std::string> set;
for(register int i=... |
#include<bits/stdc++.h>
using namespace std;
template<class T> inline bool chkmax(T& a,T b){return a<b?a=b,1:0;}
template<class T> inline bool chkmin(T& a,T b){return a>b?a=b,1:0;}
template<typename T> inline T& read(T& x){
static char c; bool flag=0;
while(!isdigit(c=getchar())) if(c=='-') flag=1;
for(x=c-... |
#include<bits/stdc++.h>
using namespace std;
int a,b,c;
multiset<string>s;
int main(){
scanf("%d%d%d",&a,&b,&c);
for(int i=1;i<=a;++i)s.insert("a");
for(int i=1;i<=b;++i)s.insert("b");
for(int i=1;i<=c;++i)s.insert("c");
while(s.size()>1){
string ss=*s.begin()+*--s.end();
s.erase(s.b... |
#include <bits/stdc++.h>
#define up(i,j,k) for (int i = (j); i <= (k); i++)
#define down(i,j,k) for (int i = (j); i >= (k); i--)
#define DEBUG printf("Passing [%s] in LINE %d\n", __FUNCTION__, __LINE__)
#define lb long double
#define ll long long
#define ull unsigned long long
#define mp std::make_pair
#define pb pu... |
#include<cstdio>
#include<algorithm>
using namespace std;
int X, Y, Z, n;
int D[51][51][51][51], LCP[51], oto[51];
char p[60], q[110];
bool Pos(int pv){
int i, j, k, l;
for(i=1;i<=pv;i++){
for(j=0;j<=pv-i;j++){
if(p[j]!=p[i+j]){
if(p[j] > p[i+j])return false;
... |
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx")
using namespace std;
using ll = long long;
using ull = unsigned long long;
using ld = long double;
#define forn(i, a, n) for (int i = (int)(a); i < (int)(n); ++i)
#define ford(i, a, n) for (int i = (in... |
/* Stay hungry, stay foolish. */
/* Copyright by HenryLi */
#include<iostream>
#include<algorithm>
#include<queue>
#include<string>
#include<map>
#include<vector>
#include<set>
#include<sstream>
#include<stack>
#include<ctime>
#include<cmath>
#include<cctype>
#include<climits>
#include<cstring>
#include<cstdio>
#includ... |
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <string>
#include <algorithm>
#include <set>
template<typename T> inline void read(T &x) {
x = 0; char c = getchar(); bool flag = false;
while (!isdigit(c)) { if (c == '-') flag = true; c = getchar(); }
while (isdigit(c)) { x = ... |
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<cstring>
#include<set>
using namespace std;
int x,y,z;
multiset<string> s;
int main(){
scanf("%d %d %d",&x,&y,&z);
for(int i=1;i<=x;i++) s.insert("a");
for(int i=1;i<=y;i++) s.insert("b");
for(int i=1;i<=z;i++) s.insert("c");
multiset<string>::iterat... |
#include<stdio.h>
#include<vector>
#include<algorithm>
#include<string>
#include<iostream>
using namespace std;
string get(int a, int b, int c)
{
string s;
if (b == 0 && c == 0)
{
for (int i = 0; i < a; i++)s.push_back('a');
return s;
}
if (a == 0)
{
s = get(b, c, 0);
for (int i = 0; i < s.size(); i++)s[i... |
#include<bits/stdc++.h>
using namespace std;
string s[233];
int t,n;
int main(){
for (char c='a';c<='c';c++)
for (cin>>t;t--;) s[n++]+=c;
for (;n>1;){
sort(s,s+n);
s[0]+=s[--n];
}
cout<<s[0];
} |
#include <set>
#include <string>
#include <iostream>
int X,Y,Z;
std::multiset<std::string> s;
int main()
{
std::ios::sync_with_stdio(false);
std::cin.tie(0),std::cout.tie(0);
std::cin>>X>>Y>>Z;
while(X--)s.insert(std::string("a"));
while(Y--)s.insert(std::string("b"));
while(Z--)s.insert(std::... |
#include<cstdio>
#include<cstring>
#include<set>
using namespace std;
int a,b,c;
char s[155][155];
struct str
{
int ID;
bool friend operator < (str a,str b)
{
return strcmp(s[a.ID],s[b.ID])<0;
}
}t1,t2;
multiset<str> m;
multiset<str>::iterator it;
int main()
{
scanf("%d%d%d",&a,&b,&c);
int cnt=0;
while(a... |
//Wrong answer on test inf.
#include<bits/stdc++.h>
#define rep(i,x,y) for (int i=(x);i<=(y);i++)
#define ll long long
#define inf 1000000001
#define y1 y1___
using namespace std;
ll read(){
char ch=getchar();ll x=0;int op=1;
for (;!isdigit(ch);ch=getchar()) if (ch=='-') op=-1;
for (;isdigit(ch);ch=getchar()) x=(x<<... |
#include <algorithm>
#include <iostream>
#include <sstream>
#include <string>
#include <cstring>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cctype>
#include <cmath>
#include <list>
#include <cassert>
#include <ctime>
#include... |
// Copyright (C) 2017 Sayutin Dmitry.
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License as
// published by the Free Software Foundation; version 3
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRA... |
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
int A, B, C;
string getans(string S) {
int ca = 0, cb = 0, cc = 0;
for (int i = 0; i < S.size(); i++) {
if (S[i] == 'a') ca++;
if (S[i] == 'b') cb++;
if (S[i] == 'c') cc++;
}
if (cb == 0) return S;
vector<str... |
#include<bits/stdc++.h>
using namespace std;
int a,b,c;
multiset<string>s;
int main()
{
scanf("%d%d%d",&a,&b,&c);
for(int i = 1;i<=a;i++)s.insert("a");
for(int i = 1;i<=b;i++)s.insert("b");
for(int i = 1;i<=c;i++)s.insert("c");
for(int i = 1;i<a+b+c;i++)
{
string x = *s.begin(),y = *(--s.end());
s.erase(s.low... |
#include "bits/stdc++.h"
using namespace std;
const int maxn = 55;
string res;
bool vis[maxn][maxn][maxn][maxn];
int failure[maxn], link[maxn][3], final_ok[maxn];
void push(){
memset(failure, 0, sizeof(failure));
for(int s = 2; s <= res.size(); s++){
failure[s] = failure[s-1];
while(failure[s] >... |
#include <cstdio>
#include <set>
#include <cstring>
#include <cassert>
#include <algorithm>
#include <vector>
#include <iostream>
#include <ctime>
#include <unistd.h>
using namespace std;
#define TRACE(x) cerr << #x << " = " << x << endl
#define _ << " " <<
#define FOR(i, a, b) for (int i=(a); i<(b); i++)
#define RE... |
#include<set>
#include<cstdio>
#include<cctype>
#include<string>
inline int Read(){
char a;
int b;
while(!isdigit(a=getchar()));
b=a^'0';
while(isdigit(a=getchar()))b=(((b<<2)+b)<<1)+(a^'0');
return b;
}
int main()
{
std::multiset<std::string> set;
for(int i=Read();i;i--)set.insert("a");
for(int i=Read();i;i--... |
#include<bits/stdc++.h>
using namespace std;
int main()
{
multiset <string> s;
int a,b,c;
cin>>a>>b>>c;
for(int i=1;i<=a;i++) s.insert("a");
for(int i=1;i<=b;i++) s.insert("b");
for(int i=1;i<=c;i++) s.insert("c");
while(s.size()>1)
{
string x=*s.begin();
string y=*s.rbegin();
s.erase(s.lower_bound(x));
... |
#include <iostream>
#include <string>
#include <set>
using namespace std;
int a_num, b_num, c_num;
multiset<string> st;
int main()
{
cin >> a_num >> b_num >> c_num;
for (int i = 1; i <= a_num; i++) st.insert("a");
for (int i = 1; i <= b_num; i++) st.insert("b");
for (int i = 1; i <= c_num; i++) st.insert("c");
... |
#include<bits/stdc++.h>
typedef unsigned int uint;
typedef long long ll;
typedef unsigned long long ull;
typedef double lf;
typedef long double llf;
typedef std::pair<int,int> pii;
#define xx first
#define yy second
template<typename T> inline T max(T a,T b){return a>b?a:b;}
template<typename T> inline T min(T a,T b... |
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define si(x) scanf("%d",&x)
#define sl(x) scanf("%lld",&x)
#define pi(x) printf("%d",x)
#define pl(x) printf("%lld",x)
#define pb push_back
#define mkp make_pair
#define fi first
#define se second
#define re register
#define rep(i,m,n) for(int i=m;i<=n;... |
#include <bits/stdc++.h>
using namespace std;
#define dump(...) do{print_vars(cout<<"# "<<#__VA_ARGS__<<'=',__VA_ARGS__);cout<<endl;}while(0)
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define peri(i,a,b) for(int i=int(b);i-->int(a);)
#define rep(i,n) repi(i,0,n)
#define per(i,n) peri(i,0,n)
#define all(c) beg... |
#include <bits/stdc++.h>
#define maxn 100086
using namespace std;
int x, y, z;
multiset<string> st;
int main(){
scanf("%d%d%d", &x, &y, &z);
for(int i = 1;i <= x;i++) st.insert("a");
for(int i = 1;i <= y;i++) st.insert("b");
for(int i = 1;i <= z;i++) st.insert("c");
while(st.size() > 1){
string s = *st.begin(... |
#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
string f(vector<pair<string,int> >A)
{
if(A.size()==1)
{
string ret="";
for(int i=0;i<A[0].second;i++)ret+=A[0].first;
return ret;
}
sort(A.begin(),A.end());
int sum=0;
for(pair<string,int>p:A)
{
sum+=p.second;
}
vector<string... |
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef unsigned int uint;
typedef unsigned char uchar;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
#define REP(i,x) for(int i=0;i<(int)(x);i++)
#define REPS(i,x) for(int i=1;i<=(in... |
#include<cstdio>
#include<algorithm>
#include<iostream>
#include<cstring>
#include<vector>
#include<set>
using namespace std;
typedef long long LL;
multiset<string> s;
multiset<string> :: iterator it,it1;
int main()
{
int x,y,z;
scanf("%d%d%d",&x,&y,&z);
for (int u=1;u<=x;u++) s.insert("a");
for (int u=1;u<=y;u++) ... |
#include<bits/stdc++.h>
using namespace std;
int a,b,c;
multiset<string>s;
int main()
{
cin>>a>>b>>c;
for(int i=1;i<=a;i++)s.insert("a");
for(int i=1;i<=b;i++)s.insert("b");
for(int i=1;i<=c;i++)s.insert("c");
while(s.size()>1)
{
string ss=(*s.begin())+(*s.rbegin());
s.erase(s.be... |
#include <bits/stdc++.h>
#define che
#define debug(...) fprintf(stderr,__VA_ARGS__)
using namespace std;
typedef long long LL;
multiset<string> S;
int main(){
int n;
scanf("%d", &n);for (int i=0; i<n; i++) S.insert("a");
scanf("%d", &n);for (int i=0; i<n; i++) S.insert("b");
scanf("%d", &n);for (int i=0; i<n; i... |
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i = (a); i < (b); i++)
#define RFOR(i,b,a) for(int i = (b) - 1; i >= (a); i--)
#define ITER(it, a) for(typeof(a.begin()) it = a.begin(); it != a.end(); it++)
#define FILL(a, value) memset(a, value, sizeof(a))
#define SZ(a) (int) a.size()
#define... |
#include<bits/stdc++.h>
using namespace std;
multiset< string > S;
int main() {
int x,y,z;
scanf("%d%d%d",&x,&y,&z);
while(x--) S.insert("a");
while(y--) S.insert("b");
while(z--) S.insert("c");
while(S.size()>1) {
string a=*S.begin(),b=*S.rbegin();
S.erase(S.begin());
S.erase(--S.end());
S.insert(a+b);
... |
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef pair<int, int> pii;
#define fst first
#define snd second
#define pb push_back
#define REP(i, a, b) for(int i = (a), i##end = (b); i < i##end; ++i)
#define DREP(i, a, b) for(int i=(a-1), i##end = (b); i >=i##end; --i)
template <typename T> b... |
#include <bits/stdc++.h>
using ll = int64_t;
using ld = long double;
using namespace std;
const int MAXN = 51;
using val = vector<int>;
string ans[MAXN];
string solve(int x, int y, int z) {
int n = x + y + z;
if (!x) {
string ans = solve(y, z, 0);
for (char& c : ans) {
c++;
... |
#include <bits/stdc++.h>
using namespace std;
const int maxn = 101;
int x, y, z;
string a, b, c;
int main() {
scanf("%d%d%d", &x, &y, &z);
a = "a";
b = "b";
c = "c";
while(1) {
if(!x) {
x = y;
a = b;
y = z;
b = c;
z = 0;
}
if(!x) {
x = y;
a = b;
y = 0;
}
if(z) {
if(x <= z) {
... |
#include "bits/stdc++.h"
using namespace std;
#define fi first
#define se second
#define ll long long
#define dbg(v) cerr<<#v<<" = "<<v<<'\n'
#define vi vector<int>
#define vl vector <ll>
#define pii pair<int,int>
#define mp make_pair
#define db long double
#define pb push_back
#define all(s) s.begin(),s.end()
int main... |
#include <bits/stdc++.h>
using namespace std;
typedef signed long long ll;
#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZER... |
#include <bits/stdc++.h>
using namespace std;
long long int X, Y, Z, S, K;
static inline void exap(string &src, string s, long long int t){
for(int i = 0; i < t; ++i)src += s;
}
void twoletter(long long X, long long Y, string xc, string yc){
while(X && Y){
if(X > Y){
X -= Y;
y... |
// Copyright (C) 2017 Sayutin Dmitry.
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License as
// published by the Free Software Foundation; version 3
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRA... |
#include<bits/stdc++.h>
using namespace std;
int X,Y,Z;
multiset<string>S;
int main(){
scanf("%d%d%d",&X,&Y,&Z);
while (X--) S.insert("a");
while (Y--) S.insert("b");
while (Z--) S.insert("c");
while (S.size()>1){
string t=*S.begin()+*(--S.end());
S.erase(S.begin());S.erase(--S.end());
S.insert(t);
}
cout... |
#include <stdio.h>
#include <algorithm>
#include <assert.h>
#include <bitset>
#include <cmath>
#include <complex>
#include <deque>
#include <functional>
#include <iostream>
#include <limits.h>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stdlib.h>
#include <string... |
#include <iostream>
#include <string>
using namespace std;
string solve(string a, string b, string c, int x, int y, int z) {
if (y + z == 0) {
string res = "";
for (int i = 0; i < x; ++i) res += a;
return res;
}
if (x == 0) return solve(b, c, "", y, z, 0);
int p = x / (y + z);
int r = x % (y + z);
string A... |
#include <string>
#include <iostream>
#include <algorithm>
using namespace std;
string eval(string s) {
int n = s.size();
s += s;
string ans = "~";
for (int i = 0; i < n; ++i) {
ans = min(ans, s.substr(i, n));
}
return ans;
}
int main() {
int X, Y, Z;
cin >> X >> Y >> Z;
int N = X + Y + Z;
string ans = stri... |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
typedef pair<double,int>Q;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define mod 1000000007
#define fi first
#define sc secon... |
#include <bits/stdc++.h>
using namespace std;
string s[55];
int n,a,b,c;
int main(){
scanf("%d%d%d",&a,&b,&c);
while(a--)s[++n]="a";
while(b--)s[++n]="b";
while(c--)s[++n]="c";
s[51]="cgz ak ioi";
s[52]="ABS ak ioi";
while(n>1){
int mi=51,mx=52;
for(int i=1;i<=n;++i){
if(s[i]<s[mi])mi=i;
if(s[i]>=s[m... |
#include <cstdio>
#include <vector>
#include <stack>
#include <iostream>
#include <string>
#include <tuple>
#include <random>
#include <map>
#include <queue>
#include <set>
#include <complex>
#include <algorithm>
#include <cassert>
#include <tuple>
#include <iterator>
using namespace std;
typedef long long ll;
typed... |
#include<bits/stdc++.h>
inline int getint() {
register char ch;
while(!isdigit(ch=getchar()));
register int x=ch^'0';
while(isdigit(ch=getchar())) x=(((x<<2)+x)<<1)+(ch^'0');
return x;
}
int main() {
std::multiset<std::string> set;
for(register int i=getint();i;i--) set.insert("a");
for(... |
#include <iostream>
#include <cstdio>
#include <cstring>
#include <queue>
#include <math.h>
#include <algorithm>
#include <map>
#include <set>
using namespace std;
// std::ios::sync_with_stdio(false);
typedef long long LL;
const LL N = 107;
const int M = 2000005;
const int INF = 0x3f3f3f3f;
const double Pi = acos(-1);
... |
#include<bits/stdc++.h>
using namespace std;
multiset<string> s;
int main()
{
int a, b, c, all = 0;
scanf("%d %d %d", &a, &b, &c);
all = a + b + c;
while(a--) s.insert("a");
while(b--) s.insert("b");
while(c--) s.insert("c");
while(1)
{
if(s.size() == 1) break;
string str = (*s.begin()) + *(--s.end());
... |
#include <bits/stdc++.h>
using namespace std;
#define forn(i, n) for (int i = 0; i < int(n); i++)
#define re return
#define fi first
#define mp make_pair
#define se second
#define sz(a) (int)a.size()
#define prev previ
#define tm tmmm
#define div divv
typedef long long ll;
typedef pair<ll, ll> pll;
typedef pair<int,... |
#include<cstdio>
#include<cstring>
#include<set>
#include<algorithm>
using namespace std;
char s[100][100];
struct shion
{
int x;
shion(){}
shion(int x):x(x){}
bool operator < (const shion &a)const{return strcmp(s[x],s[a.x])<0;}
}s1,s2;
int pa;
multiset<shion>se;
multiset<shion>::iterator it;
int xi;
int main()
{
... |
#include<bits/stdc++.h>
using namespace std;
char a[55],b[55];
int A,B,C,n,m;
bool f;
void dfs(int x,int y,int z){
memset(b,0,sizeof(b));
int k=0;
if(!y&&!z){
k=x;for(int i=0;i<x;i++)b[i]='a';
}else if(!x){
dfs(y,z,0);
k=m;
for(int i=0;i<m;i++)if(a[i]=='a')b[i]='b';else if(a[i]=='b')b[i]='c';
}else if(x<=... |
#include <bits/stdc++.h>
using namespace std;
#define SZ(v) ((int)(v).size())
#define ALL(v) (v).begin(),(v).end()
#define one first
#define two second
typedef long long ll;
typedef unsigned long long ull;
typedef pair<double, double> pd;
typedef pair<int, int> pi; typedef pair<ll, int> pli;
typedef pair<ll, ll> pll;... |
// start fold
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<algorithm>
#include<vector>
#include<cstring>
#include<set>
#include<map>
#include<cmath>
#include<queue>
#include<bitset>
using namespace std;
#define ri register int
#define il inline
#define LL long long
#define ull unsigned long long
#defi... |
#pragma GCC optimize(3,"Ofast","inline")
#define R register
#include<iostream>
#include<set>
#include<cstring>
std::multiset <std::string> M;
std::multiset <std::string> :: iterator del;
int X,Y,Z;
int main(void){
std::cin>>X>>Y>>Z;
for(R int i=X;i>0;i--)
M.insert("a");
for(R int i=Y;i>0;i--)
M.insert("b");
for... |
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <string>
#include <cstring>
#include <stack>
#include <queue>
#include <cmath>
#include <ctime>
#include <bitset>
#include <utility>
#include <assert.h>
using namespace std;
#define rank rankk
#define mp... |
#include<iostream>
#include<algorithm>
#include<iomanip>
#include<cstring>
#include<cstdio>
#include<cmath>
#include<set>
#include<cctype>
using namespace std;
const int N=1e3+50;
multiset <string> v;
int a,b,c;
int main()
{
cin>>a>>b>>c;
for(int i=1;i<=a;i++)
v.insert("a");
for(int i=1;i<=b;i++)
... |
#include<iostream>
#include<cmath>
#include<cstring>
#include<cstdio>
#include<algorithm>
using namespace std;
string A[3],B[10];
int x[3],y[10];
string solve(){
if (x[1]==0&&x[2]==0){
string ans="";
for (int i=1;i<=x[0];i++) ans=ans+A[0];
return ans;
}
memset(y,0x00,sizeof y);
int num=x[2]/x[0];
for (int i=... |
#ifndef BZ
#pragma GCC optimize "-O3"
#endif
#include <bits/stdc++.h>
#define FASTIO
#ifdef FASTIO
#define scanf abacaba
#define printf abacaba
#endif
typedef long long ll;
typedef long long llong;
typedef long double ld;
typedef unsigned long long ull;
using namespace std;
/*
ll pw(ll a, ll b) {
ll ans = 1; whi... |
#include <cstdio>
#include <algorithm>
#include <iostream>
#include <string>
#include <cstring>
#include <vector>
#include <set>
#include <map>
using namespace std;
int a, b, c, xa, xb, xc;
string AA, BB, CC, ss[110];
void iter() {
for (int i = 0; i < a; i++)
ss[i] = AA;
// int now = 0;
for (int i = 0; i < c; i+... |
#include <iostream>
#include <stdio.h>
#include <fstream>
#include <algorithm>
#include <string>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <vector>
#include <limits.h>
#include <math.h>
#include <functional>
#include <bitset>
#include <iomanip>
#define repeat(i,n) for (long long i = 0; (... |
#include<cstdio>
#include<set>
#include<string>
using namespace std;
multiset<string>s;
int main(){
int aa,bb,cc,p=0;
scanf("%d%d%d",&aa,&bb,&cc);
p=aa+bb+cc;
for(;aa--;)s.insert("a");
for(;bb--;)s.insert("b");
while(cc--)s.insert("c");
while(--p){
auto st=(*s.begin())+*(--s.end());
s.erase(s.begin());
s.e... |
#include<deque>
#include<queue>
#include<vector>
#include<algorithm>
#include<iostream>
#include<set>
#include<cmath>
#include<tuple>
#include<string>
#include<chrono>
#include<functional>
#include<iterator>
#include<random>
#include<unordered_set>
#include<array>
#include<map>
#include<iomanip>
#include<assert.h>
#inc... |
#include <bits/stdc++.h>
using namespace std;
int a,b,c;
multiset<string> S;
string s1,s2,t;
int main()
{
scanf("%d%d%d",&a,&b,&c);
for (int i=1;i<=a;i++) S.insert("a");
for (int i=1;i<=b;i++) S.insert("b");
for (int i=1;i<=c;i++) S.insert("c");
for (int i=1;i<a+b+c;i++) {
t=*S.begin()+*(--S.end());
S.erase(... |
#include <bits/stdc++.h>
using namespace std;
int a,b,c;
multiset<string> s;
int main() {
scanf("%d%d%d",&a,&b,&c);
for (int i=1;i<=a;++i) s.insert("a");
for (int i=1;i<=b;++i) s.insert("b");
for (int i=1;i<=c;++i) s.insert("c");
for (int i=1;i<a+b+c;++i) {
auto l=s.begin(),r=s.end();r--;
... |
#define _USE_MATH_DEFINES
#include <cassert>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <sstream>
#include <vector>
#include <queue>
#include <stack>
#include <list>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <co... |
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <set>
using namespace std;
#define rint register int
#define gc() getchar()
inline int read(rint ans = 0, rint sgn = ' ', rint ch = gc())
{
for(; ch < '0' || ch > '9'; sgn = ch, ch = gc());
for(; ch >='0' && ch... |
#include<set>
#include<map>
#include<list>
#include<queue>
#include<stack>
#include<string>
#include<math.h>
#include<time.h>
#include<vector>
#include<bitset>
#include<memory>
#include<utility>
#include<fstream>
#include<stdio.h>
#include<sstream>
#include<iostream>
#include<stdlib.h>
#include<string.h>
#include<algor... |
#include<cmath>
#include<math.h>
#include<ctype.h>
#include<algorithm>
#include<bitset>
#include<cassert>
#include<cctype>
#include<cerrno>
#include<cfloat>
#include<ciso646>
#include<climits>
#include<clocale>
#include<complex>
#include<csetjmp>
#include<csignal>
#include<cstdarg>
#include<cstddef>
#include<cstdio>
#i... |
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
#define int ll
#define rng(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,b) rng(i,0,b)
#define gnr(i,a,b) for(int i=int(b)-1;i>=int(a);i--)
#define per(i,b) gnr(i,0,b)
#define pb push_back
#define eb emplace_back
#define a first
#define b second
... |
// This amazing code is by Eric Sunli Chen.
#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <utility>
#include <vector>
using ... |
#include<bits/stdc++.h>
inline int getint() {
register char ch;
while(!isdigit(ch=getchar()));
register int x=ch^'0';
while(isdigit(ch=getchar())) x=(((x<<2)+x)<<1)+(ch^'0');
return x;
}
int main() {
std::multiset<std::string> set;
for(register int i=getint();i;i--) set.insert("a");
for(... |
#include "bits/stdc++.h"
using namespace std;
multiset < string > s;
int a , b , c;
int main(){
cin >> a >> b >> c;
for(int i = 0 ; i < a ; ++i){
s.insert("a");
}
for(int i = 0 ; i < b ; ++i){
s.insert("b");
}
for(int i = 0 ; i < c ; ++i){
s.insert("c");
}
while(s.size() > 1){
string str = (*s.begin()) ... |
#include "bits/stdc++.h"
using namespace std;
const int maxn = 55;
string res;
int M(){
int x, y, z;
if(!(cin >> x >> y >> z)) return 0;
multiset<string> v;
for(int e = 0; e < x; e++) v.insert("a");
for(int e = 0; e < y; e++) v.insert("b");
for(int e = 0; e < z; e++) v.insert("c");
while(v.s... |
#include <bits/stdc++.h>
using namespace std;
const int maxn = 101;
multiset<string> sp;
int main() {
int x, y, z;
scanf("%d%d%d", &x, &y, &z);
while(x--)
sp.insert("a");
while(y--)
sp.insert("b");
while(z--)
sp.insert("c");
while(sp.size() > 1) {
string fir = *sp.begin();
sp.erase(sp.begin());
string... |
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<(n);i++)
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
typedef vector<int>vint;
typedef pair<int,int>pint;
typedef vector<pint>vpint;
template<typename A,typename B>inline ... |
#include <bits/stdc++.h>
using namespace std;
string a;
multiset <string> se;
int main()
{
// cin >> a;
// for(int i=0;i<a.length();i++)
// se.insert(a.substr(i,1));
int x,y,z;
cin >> x >> y >> z;
for(int i=1;i<=x;i++)
se.insert("a");
for(int i=1;i<=y;i++)
se.insert("b");
for(int i=1;i<=z;i++)
se.insert("c"... |
#include<bits/stdc++.h>
using namespace std;
int main() {
multiset<std::string> set;
int i;
for(cin>>i; i; i--) set.insert("a");
for(cin>>i; i; i--) set.insert("b");
for(cin>>i; i; i--) set.insert("c");
while(set.size()>1) {
std::string s=*set.begin(),t=*set.rbegin();
set.erase(set.lower_bound(s));
set.eras... |
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define all(c) c.begin(),c.end()
#define pb push_back
#define fs first
#define sc second
#define show(x) cout << #x << " = " << x << endl
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
using... |
// ※※※ 解答不能 ※※※
// snuke氏.
// https://atcoder.jp/contests/code-festival-2017-qualb/submissions/1636517
#include <bits/stdc++.h>
using namespace std;
#define repex(i, a, b, c) for(int i = a; i < b; i += c)
#define repx(i, a, b) repex(i, a, b, 1)
#define rep(i, n) repx(i, 0, n)
#define repr(i, a, b) for(int i = a; i >= b... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.