QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#240016#5483. Class Field Tripkareemsakkary#AC ✓1ms3520kbC++141.6kb2023-11-05 07:28:012023-11-05 07:28:01

Judging History

你现在查看的是最新测评结果

  • [2023-11-05 07:28:01]
  • 评测
  • 测评结果:AC
  • 用时:1ms
  • 内存:3520kb
  • [2023-11-05 07:28:01]
  • 提交

answer

#include <bits/stdc++.h>

#define all(x) (x).begin(), (x).end()
#define endl '\n'
#define yes cout << "YES\n";
#define no cout << "NO\n";
#define fr(n) for(ll i = 0 ; i < n ; i++)
#define frj(n) for(ll j = 0 ; j < n ; j++)
#define ll long long
#define files    freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);
#define Ksakkary ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

const ll mod = 1e9 + 7;

using namespace std;


ll gcd(ll a, ll b) {
    if (b == 0) return a;
    return gcd(b, a % b);
}

ll mult(ll a, ll b) {
    return ((a % mod) * (b % mod)) % mod;
}

ll add(ll a, ll b) {
    return ((a % mod) + (b % mod)) % mod;
}

ll subtract(ll a, ll b) {
    return ((a % mod) - (b % mod) + (2 * mod)) % mod;
}

const unsigned ll N = 2e6 + 5;

int knightX[] = {-2, -2, 2, 2, 1, 1, -1, -1};
int knighty[] = {-1, 1, -1, 1, -2, 2, -2, 2};

int dx[] = {1, 0, -1, 0, -1, -1, 1, 1};
int dy[] = {0, -1, 0, 1, -1, 1, -1, 1};
char di[] = {'D', 'L', 'U', 'R'};


void solve() {
    string x , y; cin >> x >> y;
    int i = 0 , j = 0;
    string ans ;
    sort(x.begin(), x.end());
    sort(y.begin(), y.end());
    while (i < x.size() && j < y.size()){
        if(x[i] < y[j]){
            ans += x[i];
            i++;
        }else{
            ans += y[j++];
        }
    }
    while(i < x.size()) ans+=x[i++];
    while(j < y.size()) ans+=y[j++];
    cout << ans << endl;
}

int main() {
    Ksakkary
#ifndef ONLINE_JUDGE
    files
#endif
    // sieve();
    ll t = 1;
//    cin >> t;
    while (t--) {
        solve();
    }
    return 0;
}

詳細信息

Test #1:

score: 100
Accepted
time: 1ms
memory: 3452kb

input:

ahjmnoy
acijjkll

output:

aachijjjkllmnoy

result:

ok single line: 'aachijjjkllmnoy'

Test #2:

score: 0
Accepted
time: 0ms
memory: 3388kb

input:

a
a

output:

aa

result:

ok single line: 'aa'

Test #3:

score: 0
Accepted
time: 0ms
memory: 3392kb

input:

aaaabbccddeeeefghijjknnnoopqrssssstttuuvwwxxxyyyyy
abbcefgghiiiiiijjjllllmmnnooqqrssttuvvwxxxxxyyzzzz

output:

aaaaabbbbcccddeeeeeffggghhiiiiiiijjjjjkllllmmnnnnnoooopqqqrrssssssstttttuuuvvvwwwxxxxxxxxyyyyyyyzzzz

result:

ok single line: 'aaaaabbbbcccddeeeeeffggghhiiii...tttuuuvvvwwwxxxxxxxxyyyyyyyzzzz'

Test #4:

score: 0
Accepted
time: 0ms
memory: 3468kb

input:

aaaaabcdegghhhijlllmmnnnooppppqqrrrrssttuvwwwxyyzz
aabbbbccgggggijjjjlllmmmnnooppqrtttuuuvvvwxxxxxyzz

output:

aaaaaaabbbbbcccdeggggggghhhiijjjjjllllllmmmmmnnnnnooooppppppqqqrrrrrsstttttuuuuvvvvwwwwxxxxxxyyyzzzz

result:

ok single line: 'aaaaaaabbbbbcccdeggggggghhhiij...stttttuuuuvvvvwwwwxxxxxxyyyzzzz'

Test #5:

score: 0
Accepted
time: 0ms
memory: 3420kb

input:

aaaaabbbbcdeeeffggggghhhhiiiijjjjkklllllmmnnnnnnoooooppppppqqqqqrrrrrsssttttuuuvvvwwwwwwwwwxyyyyzzzz
a

output:

aaaaaabbbbcdeeeffggggghhhhiiiijjjjkklllllmmnnnnnnoooooppppppqqqqqrrrrrsssttttuuuvvvwwwwwwwwwxyyyyzzzz

result:

ok single line: 'aaaaaabbbbcdeeeffggggghhhhiiii...sssttttuuuvvvwwwwwwwwwxyyyyzzzz'

Test #6:

score: 0
Accepted
time: 1ms
memory: 3508kb

input:

aaaaaabbbbbbccccddeeeefgggggghiijjjjjjklllmmmnnnnnoooopppqqrrsssssttttttuuuuuvvvvwwwxxxxxxxxyyyyyyzz
z

output:

aaaaaabbbbbbccccddeeeefgggggghiijjjjjjklllmmmnnnnnoooopppqqrrsssssttttttuuuuuvvvvwwwxxxxxxxxyyyyyyzzz

result:

ok single line: 'aaaaaabbbbbbccccddeeeefggggggh...ttuuuuuvvvvwwwxxxxxxxxyyyyyyzzz'

Test #7:

score: 0
Accepted
time: 1ms
memory: 3396kb

input:

z
aaaaaabbbccdeefgggghhhhiiiiiiijjjjlllllllmmmmnnnnnooooppppqqqqrrrrrssssttttuuvvvwwwwxxxxxxyyyyzzzzzz

output:

aaaaaabbbccdeefgggghhhhiiiiiiijjjjlllllllmmmmnnnnnooooppppqqqqrrrrrssssttttuuvvvwwwwxxxxxxyyyyzzzzzzz

result:

ok single line: 'aaaaaabbbccdeefgggghhhhiiiiiii...sttttuuvvvwwwwxxxxxxyyyyzzzzzzz'

Test #8:

score: 0
Accepted
time: 0ms
memory: 3520kb

input:

aaaaabbbbcdeeeffggggghhhhiiiijjjjkklllllmmnnnnnnoooooppppppqqqqqrrrrrsssttttuuuvvvwwwwwwwwwxyyyyzzzz
aaaaaabbbbbbccccddeeeefgggggghiijjjjjjklllmmmnnnnnoooopppqqrrsssssttttttuuuuuvvvvwwwxxxxxxxxyyyyyyzz

output:

aaaaaaaaaaabbbbbbbbbbcccccdddeeeeeeefffggggggggggghhhhhiiiiiijjjjjjjjjjkkkllllllllmmmmmnnnnnnnnnnnooooooooopppppppppqqqqqqqrrrrrrrssssssssttttttttttuuuuuuuuvvvvvvvwwwwwwwwwwwwxxxxxxxxxyyyyyyyyyyzzzzzz

result:

ok single line: 'aaaaaaaaaaabbbbbbbbbbcccccddde...wwwwwwxxxxxxxxxyyyyyyyyyyzzzzzz'

Test #9:

score: 0
Accepted
time: 0ms
memory: 3452kb

input:

aaaaaabbbccdeefgggghhhhiiiiiiijjjjlllllllmmmmnnnnnooooppppqqqqrrrrrssssttttuuvvvwwwwxxxxxxyyyyzzzzzz
aaaaaabbbbbbccccddeeeefgggggghiijjjjjjklllmmmnnnnnoooopppqqrrsssssttttttuuuuuvvvvwwwxxxxxxxxyyyyyyzz

output:

aaaaaaaaaaaabbbbbbbbbccccccdddeeeeeeffgggggggggghhhhhiiiiiiiiijjjjjjjjjjkllllllllllmmmmmmmnnnnnnnnnnoooooooopppppppqqqqqqrrrrrrrsssssssssttttttttttuuuuuuuvvvvvvvwwwwwwwxxxxxxxxxxxxxxyyyyyyyyyyzzzzzzzz

result:

ok single line: 'aaaaaaaaaaaabbbbbbbbbccccccddd...xxxxxxxxxxxxxyyyyyyyyyyzzzzzzzz'

Test #10:

score: 0
Accepted
time: 0ms
memory: 3396kb

input:

aaaaabbbbcdeeeffggggghhhhiiiijjjjkklllllmmnnnnnnoooooppppppqqqqqrrrrrsssttttuuuvvvwwwwwwwwwxyyyyzzzz
aaabceehiillmnorrtv

output:

aaaaaaaabbbbbccdeeeeeffggggghhhhhiiiiiijjjjkklllllllmmmnnnnnnnooooooppppppqqqqqrrrrrrrssstttttuuuvvvvwwwwwwwwwxyyyyzzzz

result:

ok single line: 'aaaaaaaabbbbbccdeeeeeffggggghh...stttttuuuvvvvwwwwwwwwwxyyyyzzzz'

Test #11:

score: 0
Accepted
time: 0ms
memory: 3412kb

input:

z
a

output:

az

result:

ok single line: 'az'

Test #12:

score: 0
Accepted
time: 0ms
memory: 3384kb

input:

a
z

output:

az

result:

ok single line: 'az'

Test #13:

score: 0
Accepted
time: 0ms
memory: 3444kb

input:

aabeehiklmmsy
aaabceehiillmnorrtv

output:

aaaaabbceeeehhiiiklllmmmnorrstvy

result:

ok single line: 'aaaaabbceeeehhiiiklllmmmnorrstvy'

Test #14:

score: 0
Accepted
time: 0ms
memory: 3380kb

input:

ahijjmmnory
aabeehiklmmsy

output:

aaabeehhiijjklmmmmnorsyy

result:

ok single line: 'aaabeehhiijjklmmmmnorsyy'

Test #15:

score: 0
Accepted
time: 1ms
memory: 3400kb

input:

aaaaabcdegghhhijlllmmnnnooppppqqrrrrssttuvwwwxyyzz
hjno

output:

aaaaabcdegghhhhijjlllmmnnnnoooppppqqrrrrssttuvwwwxyyzz

result:

ok single line: 'aaaaabcdegghhhhijjlllmmnnnnoooppppqqrrrrssttuvwwwxyyzz'

Test #16:

score: 0
Accepted
time: 0ms
memory: 3400kb

input:

ahijjmmnory
bbbeeffggghiiijjjkkllnnnoooppqqqrsttuuvvwwwwwwyyzz

output:

abbbeeffggghhiiiijjjjjkkllmmnnnnooooppqqqrrsttuuvvwwwwwwyyyzz

result:

ok single line: 'abbbeeffggghhiiiijjjjjkkllmmnnnnooooppqqqrrsttuuvvwwwwwwyyyzz'

Test #17:

score: 0
Accepted
time: 1ms
memory: 3420kb

input:

aabbbbccgggggijjjjlllmmmnnooppqrtttuuuvvvwxxxxxyzz
aabeehiklmmsy

output:

aaaabbbbbcceeggggghiijjjjkllllmmmmmnnooppqrstttuuuvvvwxxxxxyyzz

result:

ok single line: 'aaaabbbbbcceeggggghiijjjjkllllmmmmmnnooppqrstttuuuvvvwxxxxxyyzz'

Test #18:

score: 0
Accepted
time: 0ms
memory: 3400kb

input:

aaabceehiillmnorrtv
aaaabbccddeeeefghijjknnnoopqrssssstttuuvwwxxxyyyyy

output:

aaaaaaabbbcccddeeeeeefghhiiijjkllmnnnnooopqrrrsssssttttuuvvwwxxxyyyyy

result:

ok single line: 'aaaaaaabbbcccddeeeeeefghhiiijj...ooopqrrrsssssttttuuvvwwxxxyyyyy'