Submission #70963476
Source Code Expand
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <cmath>
#include <bitset>
#include <numeric>
using namespace std;
#define ll long long
#define vi vector<int>
#define vs vector<string>
#define vll vector<long long>
#define vii vector<pair<int, int>>
#define vllvector vector<pair<ll, ll>>
#define vb vector<bool>
#define yes cout << "Yes" << endl;
#define no cout << "No" << endl;
#define rep(i, n) for (int i = 0; i < n; i++)
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true;} return false;}
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true;} return false;}
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
string x;
cin >> x;
sort (x.begin(), x.end());
int index = -1;
if(x[0] == '0') {
// cout << x << endl;
rep(i, x.size()) {
if (x[i] != '0') {
index = (int)i;
break;
}
}
}
if (index != -1) {
swap(x[0], x[index]);
}
cout << x << endl;
}
Submission Info
| Submission Time | |
|---|---|
| Task | B - Permute to Minimize |
| User | kar1neko |
| Language | C++23 (GCC 15.2.0) |
| Score | 200 |
| Code Size | 1168 Byte |
| Status | AC |
| Exec Time | 1 ms |
| Memory | 3664 KiB |
Compile Error
./Main.cpp: In function 'int main()':
./Main.cpp:21:37: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
21 | #define rep(i, n) for (int i = 0; i < n; i++)
| ^
./Main.cpp:36:9: note: in expansion of macro 'rep'
36 | rep(i, x.size()) {
| ^~~
Judge Result
| Set Name | Sample | All | ||||
|---|---|---|---|---|---|---|
| Score / Max Score | 0 / 0 | 200 / 200 | ||||
| Status |
|
|
| 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 | 1 ms | 3604 KiB |
| 00_sample_01.txt | AC | 1 ms | 3548 KiB |
| 00_sample_02.txt | AC | 1 ms | 3604 KiB |
| 01_test_00.txt | AC | 1 ms | 3516 KiB |
| 01_test_01.txt | AC | 1 ms | 3568 KiB |
| 01_test_02.txt | AC | 1 ms | 3664 KiB |
| 01_test_03.txt | AC | 1 ms | 3612 KiB |
| 01_test_04.txt | AC | 1 ms | 3548 KiB |
| 01_test_05.txt | AC | 1 ms | 3512 KiB |
| 01_test_06.txt | AC | 1 ms | 3536 KiB |
| 01_test_07.txt | AC | 1 ms | 3620 KiB |
| 01_test_08.txt | AC | 1 ms | 3568 KiB |
| 01_test_09.txt | AC | 1 ms | 3612 KiB |
| 01_test_10.txt | AC | 1 ms | 3504 KiB |
| 01_test_11.txt | AC | 1 ms | 3512 KiB |
| 01_test_12.txt | AC | 1 ms | 3664 KiB |
| 01_test_13.txt | AC | 1 ms | 3664 KiB |