Submission #70957384


Source Code Expand

#include <bits/stdc++.h>

typedef long long valueType;
typedef std::vector<valueType> ValueVector;
typedef std::vector<ValueVector> ValueMatrix;
typedef std::vector<ValueMatrix> ValueCube;
typedef std::string string;
typedef std::vector<string> StringVector;
typedef std::vector<bool> bitset;
typedef std::vector<bitset> BitMatrix;
typedef std::pair<valueType, valueType> ValuePair;
typedef std::vector<ValuePair> PairVector;
typedef std::vector<PairVector> PairMatrix;
typedef std::tuple<valueType, valueType, valueType> ValueTuple;
typedef std::vector<ValueTuple> TupleVector;
typedef std::vector<TupleVector> TupleMatrix;
typedef std::set<valueType> ValueSet;

int main() {
    std::ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    std::cout.tie(nullptr);

    string S;

    std::cin >> S;

    std::sort(S.begin(), S.end());

    valueType firstNonZeroIndex = -1;

    for (valueType i = 0; i < S.length(); ++i) {
        if (S[i] != '0') {
            firstNonZeroIndex = i;
            break;
        }
    }

    if (firstNonZeroIndex != -1) {
        std::swap(S[0], S[firstNonZeroIndex]);
    }

    std::cout << S << std::endl;
}

Submission Info

Submission Time
Task B - Permute to Minimize
User UserUnauthorized
Language C++23 (Clang 21.1.0)
Score 200
Code Size 1194 Byte
Status AC
Exec Time 3 ms
Memory 2920 KiB

Compile Error

./Main.cpp:32:29: warning: comparison of integers of different signs: 'valueType' (aka 'long long') and 'size_type' (aka 'unsigned long') [-Wsign-compare]
   32 |     for (valueType i = 0; i < S.length(); ++i) {
      |                           ~ ^ ~~~~~~~~~~
1 warning generated.

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 200 / 200
Status
AC × 3
AC × 17
Set Name Test Cases
Sample 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt
All 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt, 01_test_00.txt, 01_test_01.txt, 01_test_02.txt, 01_test_03.txt, 01_test_04.txt, 01_test_05.txt, 01_test_06.txt, 01_test_07.txt, 01_test_08.txt, 01_test_09.txt, 01_test_10.txt, 01_test_11.txt, 01_test_12.txt, 01_test_13.txt
Case Name Status Exec Time Memory
00_sample_00.txt AC 3 ms 2744 KiB
00_sample_01.txt AC 1 ms 2748 KiB
00_sample_02.txt AC 1 ms 2808 KiB
01_test_00.txt AC 1 ms 2920 KiB
01_test_01.txt AC 1 ms 2780 KiB
01_test_02.txt AC 1 ms 2780 KiB
01_test_03.txt AC 1 ms 2912 KiB
01_test_04.txt AC 1 ms 2724 KiB
01_test_05.txt AC 1 ms 2780 KiB
01_test_06.txt AC 1 ms 2748 KiB
01_test_07.txt AC 1 ms 2920 KiB
01_test_08.txt AC 1 ms 2920 KiB
01_test_09.txt AC 1 ms 2916 KiB
01_test_10.txt AC 1 ms 2756 KiB
01_test_11.txt AC 1 ms 2684 KiB
01_test_12.txt AC 1 ms 2820 KiB
01_test_13.txt AC 1 ms 2848 KiB