QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#90037#5483. Class Field TripEasyJudgeAC ✓3ms3468kbC++23759b2023-03-22 02:49:592023-03-22 02:50:01

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-03-22 02:50:01]
  • 评测
  • 测评结果:AC
  • 用时:3ms
  • 内存:3468kb
  • [2023-03-22 02:49:59]
  • 提交

answer

#include <iostream>
#include <string>
using namespace std;

int main() {
    // read in Ann's and Ben's lists
    string ann, ben;
    cin >> ann >> ben;

    // initialize variables for the merged list
    string merged = "";
    int i = 0, j = 0;

    // merge Ann's and Ben's lists
    while (i < ann.length() && j < ben.length()) {
        if (ann[i] < ben[j]) {
            merged += ann[i];
            i++;
        } else {
            merged += ben[j];
            j++;
        }
    }
    while (i < ann.length()) {
        merged += ann[i];
        i++;
    }
    while (j < ben.length()) {
        merged += ben[j];
        j++;
    }

    // output the merged list
    cout << merged << endl;

    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 2ms
memory: 3388kb

input:

ahjmnoy
acijjkll

output:

aachijjjkllmnoy

result:

ok single line: 'aachijjjkllmnoy'

Test #2:

score: 0
Accepted
time: 2ms
memory: 3312kb

input:

a
a

output:

aa

result:

ok single line: 'aa'

Test #3:

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

input:

aaaabbccddeeeefghijjknnnoopqrssssstttuuvwwxxxyyyyy
abbcefgghiiiiiijjjllllmmnnooqqrssttuvvwxxxxxyyzzzz

output:

aaaaabbbbcccddeeeeeffggghhiiiiiiijjjjjkllllmmnnnnnoooopqqqrrssssssstttttuuuvvvwwwxxxxxxxxyyyyyyyzzzz

result:

ok single line: 'aaaaabbbbcccddeeeeeffggghhiiii...tttuuuvvvwwwxxxxxxxxyyyyyyyzzzz'

Test #4:

score: 0
Accepted
time: 3ms
memory: 3320kb

input:

aaaaabcdegghhhijlllmmnnnooppppqqrrrrssttuvwwwxyyzz
aabbbbccgggggijjjjlllmmmnnooppqrtttuuuvvvwxxxxxyzz

output:

aaaaaaabbbbbcccdeggggggghhhiijjjjjllllllmmmmmnnnnnooooppppppqqqrrrrrsstttttuuuuvvvvwwwwxxxxxxyyyzzzz

result:

ok single line: 'aaaaaaabbbbbcccdeggggggghhhiij...stttttuuuuvvvvwwwwxxxxxxyyyzzzz'

Test #5:

score: 0
Accepted
time: 2ms
memory: 3404kb

input:

aaaaabbbbcdeeeffggggghhhhiiiijjjjkklllllmmnnnnnnoooooppppppqqqqqrrrrrsssttttuuuvvvwwwwwwwwwxyyyyzzzz
a

output:

aaaaaabbbbcdeeeffggggghhhhiiiijjjjkklllllmmnnnnnnoooooppppppqqqqqrrrrrsssttttuuuvvvwwwwwwwwwxyyyyzzzz

result:

ok single line: 'aaaaaabbbbcdeeeffggggghhhhiiii...sssttttuuuvvvwwwwwwwwwxyyyyzzzz'

Test #6:

score: 0
Accepted
time: 2ms
memory: 3316kb

input:

aaaaaabbbbbbccccddeeeefgggggghiijjjjjjklllmmmnnnnnoooopppqqrrsssssttttttuuuuuvvvvwwwxxxxxxxxyyyyyyzz
z

output:

aaaaaabbbbbbccccddeeeefgggggghiijjjjjjklllmmmnnnnnoooopppqqrrsssssttttttuuuuuvvvvwwwxxxxxxxxyyyyyyzzz

result:

ok single line: 'aaaaaabbbbbbccccddeeeefggggggh...ttuuuuuvvvvwwwxxxxxxxxyyyyyyzzz'

Test #7:

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

input:

z
aaaaaabbbccdeefgggghhhhiiiiiiijjjjlllllllmmmmnnnnnooooppppqqqqrrrrrssssttttuuvvvwwwwxxxxxxyyyyzzzzzz

output:

aaaaaabbbccdeefgggghhhhiiiiiiijjjjlllllllmmmmnnnnnooooppppqqqqrrrrrssssttttuuvvvwwwwxxxxxxyyyyzzzzzzz

result:

ok single line: 'aaaaaabbbccdeefgggghhhhiiiiiii...sttttuuvvvwwwwxxxxxxyyyyzzzzzzz'

Test #8:

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

input:

aaaaabbbbcdeeeffggggghhhhiiiijjjjkklllllmmnnnnnnoooooppppppqqqqqrrrrrsssttttuuuvvvwwwwwwwwwxyyyyzzzz
aaaaaabbbbbbccccddeeeefgggggghiijjjjjjklllmmmnnnnnoooopppqqrrsssssttttttuuuuuvvvvwwwxxxxxxxxyyyyyyzz

output:

aaaaaaaaaaabbbbbbbbbbcccccdddeeeeeeefffggggggggggghhhhhiiiiiijjjjjjjjjjkkkllllllllmmmmmnnnnnnnnnnnooooooooopppppppppqqqqqqqrrrrrrrssssssssttttttttttuuuuuuuuvvvvvvvwwwwwwwwwwwwxxxxxxxxxyyyyyyyyyyzzzzzz

result:

ok single line: 'aaaaaaaaaaabbbbbbbbbbcccccddde...wwwwwwxxxxxxxxxyyyyyyyyyyzzzzzz'

Test #9:

score: 0
Accepted
time: 2ms
memory: 3336kb

input:

aaaaaabbbccdeefgggghhhhiiiiiiijjjjlllllllmmmmnnnnnooooppppqqqqrrrrrssssttttuuvvvwwwwxxxxxxyyyyzzzzzz
aaaaaabbbbbbccccddeeeefgggggghiijjjjjjklllmmmnnnnnoooopppqqrrsssssttttttuuuuuvvvvwwwxxxxxxxxyyyyyyzz

output:

aaaaaaaaaaaabbbbbbbbbccccccdddeeeeeeffgggggggggghhhhhiiiiiiiiijjjjjjjjjjkllllllllllmmmmmmmnnnnnnnnnnoooooooopppppppqqqqqqrrrrrrrsssssssssttttttttttuuuuuuuvvvvvvvwwwwwwwxxxxxxxxxxxxxxyyyyyyyyyyzzzzzzzz

result:

ok single line: 'aaaaaaaaaaaabbbbbbbbbccccccddd...xxxxxxxxxxxxxyyyyyyyyyyzzzzzzzz'

Test #10:

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

input:

aaaaabbbbcdeeeffggggghhhhiiiijjjjkklllllmmnnnnnnoooooppppppqqqqqrrrrrsssttttuuuvvvwwwwwwwwwxyyyyzzzz
aaabceehiillmnorrtv

output:

aaaaaaaabbbbbccdeeeeeffggggghhhhhiiiiiijjjjkklllllllmmmnnnnnnnooooooppppppqqqqqrrrrrrrssstttttuuuvvvvwwwwwwwwwxyyyyzzzz

result:

ok single line: 'aaaaaaaabbbbbccdeeeeeffggggghh...stttttuuuvvvvwwwwwwwwwxyyyyzzzz'

Test #11:

score: 0
Accepted
time: 2ms
memory: 3440kb

input:

z
a

output:

az

result:

ok single line: 'az'

Test #12:

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

input:

a
z

output:

az

result:

ok single line: 'az'

Test #13:

score: 0
Accepted
time: 2ms
memory: 3312kb

input:

aabeehiklmmsy
aaabceehiillmnorrtv

output:

aaaaabbceeeehhiiiklllmmmnorrstvy

result:

ok single line: 'aaaaabbceeeehhiiiklllmmmnorrstvy'

Test #14:

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

input:

ahijjmmnory
aabeehiklmmsy

output:

aaabeehhiijjklmmmmnorsyy

result:

ok single line: 'aaabeehhiijjklmmmmnorsyy'

Test #15:

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

input:

aaaaabcdegghhhijlllmmnnnooppppqqrrrrssttuvwwwxyyzz
hjno

output:

aaaaabcdegghhhhijjlllmmnnnnoooppppqqrrrrssttuvwwwxyyzz

result:

ok single line: 'aaaaabcdegghhhhijjlllmmnnnnoooppppqqrrrrssttuvwwwxyyzz'

Test #16:

score: 0
Accepted
time: 2ms
memory: 3324kb

input:

ahijjmmnory
bbbeeffggghiiijjjkkllnnnoooppqqqrsttuuvvwwwwwwyyzz

output:

abbbeeffggghhiiiijjjjjkkllmmnnnnooooppqqqrrsttuuvvwwwwwwyyyzz

result:

ok single line: 'abbbeeffggghhiiiijjjjjkkllmmnnnnooooppqqqrrsttuuvvwwwwwwyyyzz'

Test #17:

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

input:

aabbbbccgggggijjjjlllmmmnnooppqrtttuuuvvvwxxxxxyzz
aabeehiklmmsy

output:

aaaabbbbbcceeggggghiijjjjkllllmmmmmnnooppqrstttuuuvvvwxxxxxyyzz

result:

ok single line: 'aaaabbbbbcceeggggghiijjjjkllllmmmmmnnooppqrstttuuuvvvwxxxxxyyzz'

Test #18:

score: 0
Accepted
time: 2ms
memory: 3320kb

input:

aaabceehiillmnorrtv
aaaabbccddeeeefghijjknnnoopqrssssstttuuvwwxxxyyyyy

output:

aaaaaaabbbcccddeeeeeefghhiiijjkllmnnnnooopqrrrsssssttttuuvvwwxxxyyyyy

result:

ok single line: 'aaaaaaabbbcccddeeeeeefghhiiijj...ooopqrrrsssssttttuuvvwwxxxyyyyy'