QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#149080 | #3530. Small business | moon | WA | 1ms | 3580kb | C++20 | 3.1kb | 2023-08-23 23:53:20 | 2023-08-23 23:53:21 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int inf = numeric_limits<int>::max();
const ll inff = numeric_limits<ll>::max();
void solve() {
string s;
cin >> s;
int l = s.length();
int zero = 0;
int one = 0;
int no = 0;
if(s == "00") {
cout << "0 0 ";
return ;
}
auto check = [&]() -> void {
if(l >= 38) {
if(zero == 36 && one == 2) {
cout << "1000000000000000000 1000000000000000000";
exit(0);
} else {
cout << "-1 -1";
exit(0);
}
}
if(no == 0) {
cout << "-1 -1";
exit(0);
}
if(zero == 19) {
if(one == 1 && no == 1) {
cout << "0 1000000000000000000";
exit(0);
} else {
cout << "-1 -1";
exit(0);
}
}
if(zero > 19 && one <= 1) {
cout << "-1 -1";
exit(0);
}
};
for(auto i : s) {
if(i == '0') {
zero++;
} else if(i == '1') {
one++;
}
if(i != '0') {
no++;
}
}
check();
int pre = l - 18;
sort(s.begin(), s.end());
// cout << s << '\n';
auto con = [&](string ss) -> string {
if(ss == "0") {
return "0";
}
string ans = "";
string res = "";
bool ok = true;
for(auto i : ss) {
if(i != '0' && ok) {
ans += i;
ok = false;
} else {
res += i;
}
}
return ans + res;
};
if(pre >= 1) {
string p = "";
string t = "";
for(auto i : s) {
if(p.length() < pre) {
p += i;
} else {
t += i;
}
}
s = t;
// cout << "p : ";
// cout << p << '\n';
// cout << "s : ";
// cout << s << '\n';
if(p[pre - 1] == '0' && pre > 1) {
p.pop_back();
string tem = "0";
bool ok = true;
for(auto i : s) {
if(i != '0' && ok) {
p += i;
ok = false;
} else {
tem += i;
}
}
s = tem;
}
// cout << "p : ";
// cout << p << '\n';
// cout << "s : ";
// cout << s << '\n';
if(p == "0") {
cout << p << ' ';
} else {
cout << con(p) << ' ';
}
cout << con(s);
} else {
string ans = "";
ans += s[0];
s.erase(s.begin());
cout << ans << ' ';
cout << con(s);
}
}
int main(){
ios::sync_with_stdio(false);
cin.tie(nullptr);
int cn = 1;
// cin >> cn;
while(cn--)
solve();
return 0;
}
詳細信息
Test #1:
score: 100
Accepted
time: 0ms
memory: 3472kb
input:
123456
output:
1 23456
result:
ok ok
Test #2:
score: 0
Accepted
time: 1ms
memory: 3480kb
input:
42
output:
2 4
result:
ok ok
Test #3:
score: 0
Accepted
time: 1ms
memory: 3576kb
input:
000
output:
-1 -1
result:
ok ok
Test #4:
score: 0
Accepted
time: 1ms
memory: 3472kb
input:
4418409405
output:
0 104444589
result:
ok ok
Test #5:
score: 0
Accepted
time: 1ms
memory: 3460kb
input:
82933602294918208962
output:
10 202222334668889999
result:
ok ok
Test #6:
score: 0
Accepted
time: 0ms
memory: 3456kb
input:
264727800857314294187884421131
output:
100111122223 344444567777888889
result:
ok ok
Test #7:
score: 0
Accepted
time: 1ms
memory: 3580kb
input:
5879012924529447774473489599650098351318
output:
-1 -1
result:
ok ok
Test #8:
score: 0
Accepted
time: 1ms
memory: 3456kb
input:
61899560303187317666207432000671179900997026617305
output:
-1 -1
result:
ok ok
Test #9:
score: 0
Accepted
time: 0ms
memory: 3452kb
input:
0
output:
-1 -1
result:
ok ok
Test #10:
score: 0
Accepted
time: 1ms
memory: 3516kb
input:
0000000000000000010
output:
0 100000000000000000
result:
ok ok
Test #11:
score: 0
Accepted
time: 1ms
memory: 3576kb
input:
72
output:
2 7
result:
ok ok
Test #12:
score: 0
Accepted
time: 1ms
memory: 3580kb
input:
9407809440087866606
output:
0 400004466667788899
result:
ok ok
Test #13:
score: 0
Accepted
time: 1ms
memory: 3492kb
input:
89809008899888899001
output:
10 800008888888999999
result:
ok ok
Test #14:
score: 0
Accepted
time: 1ms
memory: 3448kb
input:
5977998750
output:
0 557778999
result:
ok ok
Test #15:
score: 0
Accepted
time: 1ms
memory: 3500kb
input:
079968486310868706
output:
0 10034666677888899
result:
ok ok
Test #16:
score: 0
Accepted
time: 1ms
memory: 3488kb
input:
8863679763487438575
output:
3 334455666777788889
result:
ok ok
Test #17:
score: 0
Accepted
time: 0ms
memory: 3456kb
input:
89989959979978899897
output:
57 778888899999999999
result:
ok ok
Test #18:
score: 0
Accepted
time: 1ms
memory: 3532kb
input:
04
output:
0 4
result:
ok ok
Test #19:
score: 0
Accepted
time: 1ms
memory: 3520kb
input:
050
output:
0 50
result:
ok ok
Test #20:
score: 0
Accepted
time: 0ms
memory: 3536kb
input:
00600
output:
0 6000
result:
ok ok
Test #21:
score: -100
Wrong Answer
time: 1ms
memory: 3524kb
input:
00000004000000000001
output:
10 400000000000000000
result:
wrong answer jury has the better answer