QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#491843#4592. Theramorefractal#AC ✓16ms3820kbC++17498b2024-07-25 23:14:232024-07-25 23:14:23

Judging History

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

  • [2024-07-25 23:14:23]
  • 评测
  • 测评结果:AC
  • 用时:16ms
  • 内存:3820kb
  • [2024-07-25 23:14:23]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;



void solve() {
    string s, was[2];
    cin >> s;
    for (int i = 0; i < s.size(); ++i) {
        was[i & 1] += s[i];
    }
    sort(was[0].begin(), was[0].end());
    sort(was[1].begin(), was[1].end());
    for (int i = 0; i < s.size(); ++i) {
        cout << was[i&1][i / 2];
    }
    cout << '\n';

}

int main() {
    ios_base::sync_with_stdio(0), cin.tie(0);
    int t = 1;
    cin >> t;
    while (t--) solve();
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 16ms
memory: 3820kb

input:

10
101001
01101100000000101010
11100100010110110011101010011111111010110100011100000001101011111001101000001010101001101101010011100101001000001011111011010001111110100101100010111110011000000101110110110001010100110001000110001101110011001101101101011000011010011010101111010010111010001001010111111...

output:

001011
00000000001010101111
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

ok 10 lines