QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#189919 | #3311. Digits Are Not Just Characters | KKT89 | AC ✓ | 1ms | 3692kb | C++17 | 1.7kb | 2023-09-28 01:31:22 | 2023-09-28 01:31:22 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main(){
cin.tie(nullptr);
ios::sync_with_stdio(false);
int n; cin >> n;
string s; cin >> s;
vector<string> str,num;
for(int i=0;i<s.size();){
string r="";
while(i<s.size() and ('0'>s[i] or '9'<s[i])){
r+=s[i];
i++;
}
str.push_back(r);
r="";
while(i<s.size() and '0'<=s[i] and s[i]<='9'){
r+=s[i];
i++;
}
num.push_back(r);
}
auto comp_num=[](string s,string t)->bool{ // s<t を返す
if(s.size()<t.size())return true;
if(t.size()<s.size())return false;
// 文字列が同じ場合はif文で除いておく
for(int i=0;i<s.size();i++){
if(s[i]==t[i])continue;
if(s[i]<t[i])return true;
if(s[i]>t[i])return false;
}
return true;
};
while(n--){
string ss; cin >> ss;
if(ss.substr(0,s.size())==s){
printf("+\n"); continue;
}
if(s.substr(0,ss.size())==ss){
printf("-\n"); continue;
}
vector<string> Str,Num;
for(int i=0;i<ss.size();){
string r="";
while(i<ss.size() and ('0'>ss[i] or '9'<ss[i])){
r+=ss[i];
i++;
}
Str.push_back(r);
r="";
while(i<ss.size() and '0'<=ss[i] and ss[i]<='9'){
r+=ss[i];
i++;
}
Num.push_back(r);
}
auto solve=[](auto comp_num,vector<string> v1,vector<string> v2,vector<string> g1,vector<string> g2)->bool{
int i=0;
for(;i<10000;i++){
if(g1[i]<v1[i])return true;
if(g1[i]>v1[i])return false;
if(g2[i]==v2[i])continue;
if(comp_num(g2[i],v2[i]))return true;
else return false;
}
return true;
};
if(solve(comp_num,str,num,Str,Num)){
printf("-\n");
}
else{
printf("+\n");
}
}
}
詳細信息
Test #1:
score: 100
Accepted
time: 1ms
memory: 3656kb
input:
100 3Z72Z 54Z19x95a 22x7x54Z5 74a1a29x5 1x30x3Z1x 97a 5Z7x5x36a 61Z60x65Z 7a 2a6Z27Z76 45a97x1x3 93Z8Z11a6 63a20x 83Z4a99Z9 40x28Z87x 58a 3Z94Z5Z66 48Z48x62a 5x55x88Z4 1a6a41x76 32x49a77a 82x31x67a 60a8Z90a 3 14Z62x46x 88a5a41x1 6 3Z18Z1x40 1x20Z11a7 50x 91x6Z5x6Z 1x81a7a49 8a8a12a15 93Z7Z1a37 7x6Z2...
output:
+ + + - + + + + - + + + + + + + + + - + + + - + + + - - + + - + + + + - + + + + + + + + + + + - + + + + + + + + + - + + + + + + + + + + + + + + + + + + + + + - + + + + - + + + + + + + + + + + - + + +
result:
ok 100 lines
Test #2:
score: 0
Accepted
time: 1ms
memory: 3592kb
input:
200 42x88x60a 8Z62x3 30a21 7Z40a86a8 16x84a64a 28x29a73a 89x7x59a3 91Z56Z52x 10 22a8x10a7 12 60Z45Z73a 92x56a19Z 97x69x94x 1a3Z6x8x8 3 4 5 35Z8x31a1 21Z82Z43Z 7 8 42x5a70a6 69Z37a3a9 79x7x98Z2 1a8Z61Z98 39a30x71a 12x41Z11Z 42x7Z26a7 98x46 28 59Z45a93x 14x72x17a 6Z29Z73x5 69x1x72Z 48Z 4x5Z8Z29Z 31 33...
output:
- - - - - + + - - - + + + - - - - - - - - - + + - - - - + - + - - + + - - - - - - - - - + - - + + - + + + - + + - + - - - - + + - + + + - - - + - - - + - - - + + + + + + + - + - + - + - - - - - + + + + + + - + - + - + - - + - - + + - - - + + - - + - + + - - + - - + - - + - - - - - - + + - + + + - + ...
result:
ok 200 lines
Test #3:
score: 0
Accepted
time: 1ms
memory: 3520kb
input:
200 a48a57x70 a4x3Z48a9 Z98x61a95 Z5x29x56x a34a25a3x a5a2Z24 x61x8Z3Z5 Z42Z98x1a x3x5a3Z64 a2Z70a52x a8a2a24x3 a8a43Z5Z4 Z6x17x8x2 Z30a33Z80 Z15a3Z6a1 a96x45a17 a4Z84a5 Z73x67Z74 Z10x3a x8x29x2Z7 x23x69a82 Z2Z82a13Z x50a85a67 Z57x68x23 Z65Z3a62Z Z38x31 Z1x94x81Z a64Z90Z35 x6Z4x96x8 x7Z8a1x56 Z39Z42...
output:
- - - - - + - + - - - - - - + - - - + + - + - - - - + + + - - - - - - + - - - + - - + - + - + - - + + + + + - - + - - + - + + - - - - + - - - + - + + + - - - + - + - + - + + - - + + + - - + - + + - + - - + + - + + - - + + - + + - - - - + - - - + - - + - - + + + - - - + + - + - + + - + + - + - - + + ...
result:
ok 200 lines
Test #4:
score: 0
Accepted
time: 0ms
memory: 3624kb
input:
100 bbA Az72AA68A zbb3zb53z zz58b6zbb AA85AAA97 zb7b87A2b A8zA48A5b zA7A72 z19zAb36z AAb97zb11 zAA bA Ab50b15b8 zb94zz4zA z30AA39z9 A5bb84b94 b82zb15A8 Ab65bbA7b AA64AzA54 zAA31 z7b69Azb9 A8z1zz5 zAb bA76Azz2b A43zA13zz zz7bb5A42 A z66A94bA9 zb55AzA3z zA1bb6bA1 Az25Abb38 Az32AA49A Abz Ab45Az62A z6zb...
output:
- + + - + - + + - + - - + + - - - - + + - + - - + - + + + - - - - + - + - - + + - - - - - + + + - + - - + + + - - - + + - - - - + + + - + + - - + + - + + - - - - + - - - + + - + - - - - - - + + - - +
result:
ok 100 lines
Test #5:
score: 0
Accepted
time: 0ms
memory: 3520kb
input:
100 51mm4zK91 7zmK58K25 95z47mz65 19z45m80z 3mm85z4m3 93K1K75 57KK42zm6 90K12 4mmK40z28 55mK87 12zKz91m 4K68zKK79 1zm1mK7KK 88Kz11m73 3m65mz14m 6mmz5mz68 59K2Kz62z 6K51 56Kz76mK1 72KK96m13 74KzK54mK 7mKm50K27 17mz78KK8 5 67Kz4 42KK6mzz 4mm77m77 64KKK23z8 32zz93KK8 2zK2Km6z8 7Km7mz68m 8mK21K80m 13mm5...
output:
- + - - + + + - + - - - + - - + - + + + - - - + - - + - - - - - - - - - + - + + + + - - - - + + - + - + - - + + - + + - - - + + + - - - + + - - - + - - + - + - - + - - - + - - - - + - + - - - - - - -
result:
ok 100 lines
Test #6:
score: 0
Accepted
time: 1ms
memory: 3564kb
input:
10 123 1 12 123 2 AB 123a a123 A12 1234 123X
output:
- - + - + + + + + +
result:
ok 10 lines
Test #7:
score: 0
Accepted
time: 0ms
memory: 3616kb
input:
10 123 123X 1234 1 AB 123a 12 a123 A12 123 2
output:
+ + - + + - + + + -
result:
ok 10 lines
Test #8:
score: 0
Accepted
time: 1ms
memory: 3520kb
input:
2 999999999 ABCDEFGHI 111111111
output:
+ -
result:
ok 2 lines
Test #9:
score: 0
Accepted
time: 1ms
memory: 3588kb
input:
8 11A22BCD4 999999999 11A22BCD4 99A99XYZ9 9A9999999 z99999999 zzzzzzzzz 6z 10
output:
+ + + - + + - -
result:
ok 8 lines
Test #10:
score: 0
Accepted
time: 1ms
memory: 3616kb
input:
16 A 1 a 2 AB 10 A 111 A1 222 B 3333 44444 C CDE XYZ xyz
output:
- + - + - + - + - + - - + + + +
result:
ok 16 lines
Test #11:
score: 0
Accepted
time: 0ms
memory: 3660kb
input:
32 18445711 47 54427962 64048617 63584133 9040 4665012 233 32481758 52834 15511881 917 33 780267 14 91797192 97525 20607 482542 1426 104609 79465 97456829 1953121 74349188 962 6 7 8 9 48297 6816 98776947
output:
- + + + - - - + - - - - - - + - - - - - - + - + - - - - - - - +
result:
ok 32 lines
Test #12:
score: 0
Accepted
time: 0ms
memory: 3552kb
input:
2 file20 file3 file10
output:
- -
result:
ok 2 lines
Test #13:
score: 0
Accepted
time: 0ms
memory: 3584kb
input:
11 X52Y X X5 X52 X52Y X52Y6 32 ABC XYZ x51y X8Y X222
output:
- - - + + - - + + - +
result:
ok 11 lines
Test #14:
score: 0
Accepted
time: 1ms
memory: 3612kb
input:
4 icpc2018 icpcACM acm2018 icpc20 icpc20180
output:
+ - - +
result:
ok 4 lines
Test #15:
score: 0
Accepted
time: 1ms
memory: 3692kb
input:
6 X 100 A a X20 XYZ 100X1Y2
output:
- - + + + -
result:
ok 6 lines
Test #16:
score: 0
Accepted
time: 0ms
memory: 3644kb
input:
9 X52Y X X5 X52 X52Y X52Y6 32 XYZ X8Y X222
output:
- - - + + - + - +
result:
ok 9 lines
Test #17:
score: 0
Accepted
time: 1ms
memory: 3516kb
input:
7 10x10 9x9 9x11 10x9 10x10 10a11 100x1 xyz
output:
- - - + - + +
result:
ok 7 lines
Test #18:
score: 0
Accepted
time: 0ms
memory: 3612kb
input:
10 IJqE421cR 413O72NpO 97q yvPJ687f1 DwXUxlgJe TIDDJM861 420947obO ySPltPyru rl877M61k OEujpZtav CO917HQ90
output:
- - + - + - + + + -
result:
ok 10 lines
Test #19:
score: 0
Accepted
time: 1ms
memory: 3640kb
input:
1000 9076oFsir 19B69sVVK gNd62G75i u91295sRb Ah91fNcMe ZWjQdhjDa 14o60qfm4 mcL474wLO 84597M362 96dsLe829 nqHmYj321 v129J412A a47295whI AB 30bk95Ezh mNvbVoJMV z115wkuuM zCQX45328 u5465GPRM KQ701vRG3 167k127gj SDb H86hxp58G LP51lsTwr Zj39qJoh8 feEd67921 Rogyiuung 592984597 L77DgTjpI DhotF741q 64VdEZjM...
output:
- + + + + - + + - + + + + - + + + + + - + + + + + + + + + - + + + + + + + + + + + + + + + + + + + + - + + + + + + + + - + + - + + + - + + + + + + + + + + + - + - + + + + + + - + - + + + - + + + + + + + + + + + + + + + + + + + + + - + + + + + + + + - + + + - - + + + + + + - + + + + + + + + + + + + - ...
result:
ok 1000 lines
Test #20:
score: 0
Accepted
time: 1ms
memory: 3516kb
input:
1000 407037 87691181 661492 34765616 148999 76021 8090 4265473 58902657 56417 161738 57655234 9193 617765 1 5828 2 2557 3 4 272221 5 9190 6 7 8 9 11995 11516950 11510 806 19687 17264 69507 556032 4005936 175916 1476 810 939647 19207 33435227 75790142 22867 3672 55113 3424 29017 58861 825 826 827 540...
output:
+ + + - - - + + - - + - + - - - - - - - - - - - - - - + - - - - - + + - - - + - + + - - - - - - - - - + - + + + + - - + - - + - + - - - + - - - - + - - + - - + - + + + - + + + - - - + + + - - - - - - - + - + - - + + - + - - + + - - - - - - - - - - + - + - - + + + + + + - + + + + - + - + - + + + - + ...
result:
ok 1000 lines
Test #21:
score: 0
Accepted
time: 1ms
memory: 3616kb
input:
200 5m3mK 78mm2m3Km 74m90Km68 88Kzm84zm 2zK60K72z 40z1z8mz 2K7zK1KKK 30mz3mz3K 2m38Kz90m 45KKm26z1 38zzm28KK 75mK64mz1 49KKz6zm8 10z45Kz93 1 2K79m 28KK 5 5K35zz4z2 70zz3mKm5 7 18KK65m26 29zz27zK8 22z 1K 4zKK62mKm 65K40zzz9 20 18KKm11z4 48mm92Kz5 19m60mm16 4zK 60zm91zK3 89z81z1Km 7Kmm77Kz6 3K1Kmz4mm ...
output:
+ + + - + - + - + + + + + - - + - - + + + + + - - + + + + + - + + + - - + + - + + + + + + + + + + + + + + + + + - - + + + + - + + + + + - + + + + + + + + + + + + - + - + - + - + + + + + + + + + + - + + + + + - + + + + + + - + + + - + + + + - + + + + - + + + + + + + + + + + + + + + + - + + + + + + + ...
result:
ok 200 lines
Test #22:
score: 0
Accepted
time: 1ms
memory: 3516kb
input:
200 69mKm88mm 67mmz26m5 58zKz5zK4 74K62Km54 6KK48 14K2zK54K 3m1zz52m1 52mK3K3zK 6KmK44K3K 51Kz64K8m 26z5z3z24 16zKm6mKm 75zKK39mK 45z17zz40 7m63zzK35 35mmK4K25 15zz63zm1 72mK47zz4 14mK59m17 47K54 8zm4 66KK68K70 2m5zmz6zm 14z80z17z 5 20zz6KKK6 82zmK4z13 2zz5zz6mz 78m2K8Kz1 46mmK3Kz9 66K8Kz83z 51m19mK...
output:
- - + - - - - - - - - + - - - - + - - - - - - - - + - + - - - - - - + - + - - + - - - - - - - - - - - + - - + + + - - - + + - + - - - - - - - - - + - - - - - + - - + - + - - + - - - - + - - + - - - - - + - - - + - - + - - - - - - + - + - - - - - + - + - - - + - - - - - - - - - + - - - - + - - + - - ...
result:
ok 200 lines
Test #23:
score: 0
Accepted
time: 0ms
memory: 3616kb
input:
500 47zm23Km3 38K99zKz8 6zm77Kzz1 1zm67mz6m 3m3m53z6z 85zK5 45zm46K 63KK67m 76Kz70K66 49KK53m93 14K4z3mm3 19m34K2m7 7zKm55m51 3KzK85zm8 90mKm10zK 95KKm26zK 97Km1 1 2 81zm90KKz 4 6mK 5 19m95KK54 6 7 8 53mm8 3KK87zm31 82KK80zK4 65Km6m25 5mz4K3KK8 47mz85mK6 24zK87m73 82K32m17m 54Kz6K77m 39mmm 8mm85zzK3...
output:
- - - - + - + + + - - - - + + + - - + - - - - - - - + - + + - - - + + - - - + - - + + + - - - - + + - - + - + - - - + + - - + - - - + + + + + - - - - + + - - - - - - - + + - + - - + + + + - + - - - + - - - - + - + - + + - - - - - - + - - - - - + - + - - - - + + - + - - + - - + - - - + + + + - - - - ...
result:
ok 500 lines
Test #24:
score: 0
Accepted
time: 1ms
memory: 3588kb
input:
500 75mz58zzz 41mKK 4zm65zKK7 16mK76zKm 48K88m2K8 6Kzm19KK2 17zmK78K7 88Kz3mKK6 75KK3 77mz5KK3z 1zK2Kmm3m 52K22K28z 6mm58mK10 53zz2z 52zz60mK7 87Km15 70Kz31zmm 6zK75zm 5K74z3K29 5z30mK4zK 7m39K7K51 56z40m94m 25mKK87KK 2 6 7 8 62mK74mmK 23m34mm50 50mK46z54 29K3K3mz4 95mK99KK8 20Kz48zmz 73m37Km5m 99mz...
output:
- - - - - - + - + - - - - - + - - - - - - - - - - - - - - - + - - + - - + + - + - - - - - - - - - - - - - - + - - - + - - - - - + - + - - - - - - - - - - - - + + - - - - - - - - - + - - - - - - - - - - - - - - - - - + - - - - - - + - - - - - - - - - - - - - - - - + - + - - + - - - - - - + + - + + - ...
result:
ok 500 lines
Test #25:
score: 0
Accepted
time: 1ms
memory: 3664kb
input:
1000 7m49 35KK7z21K 26K3zK18 1zmz12zzz 3zz59zK4K 35mmK7mm7 7m6z6mmz2 90m8mm91m 4mz41 38Kz41zK6 73mz2K14K 93zKm3Km 30mKm1m2K 47KmK2K13 46Km48m7 15zKm 5mmz3mmm3 2zz52mm57 30mK75m8K 72KK41zK1 10mz 7mzK69m6z 63Kz3K6zK 20KK77mK6 72m8mzK 71zz91zK4 2zm64m85 2mK78zz 46KK89mK 4mKm69K4K 96m17K54z 97mm5Kz4K 2m...
output:
+ + - - + - + - + + + + + + + - - + + + + + + + + - - + - + + - - + - + - + - - + - + - + - - - + - - - + + + - + + + - + + + + + + - - - + + + - + + + + + + + + + + + + + - + - + + + + + + - + + + + + + + - + + + + + + + + + + + + + + + - + + - + + + + + + - + + - + + + + + - + + + - + - + + + + + ...
result:
ok 1000 lines
Test #26:
score: 0
Accepted
time: 1ms
memory: 3636kb
input:
1000 19zmm36z3 97mmz80mK 55zK51zmz 98m18K91K 32Km82z6m 93z24K1Km 48K63zz1 7zm67K73m 62mm70zz1 34mK74Kzz 50Kz71m24 96m40mK73 59zm14zzz 2Km4KK58m 87zzz76Kz 44z3mm58K 64mzz8Km5 1Km91KK1z 3Km26zz29 82mzm23zz 1Km3m28mK 4mz7KKK21 6mK57Km52 17m4m23mK 82z14Kmz9 72zm22z25 29z88Km1m 43m6 1 63K89zmz3 2 3 4 5 6...
output:
+ + + + + + - + + + + + - + + + - - + - - - - + + + + - + - - - - - - + - - + + - + - + - + + + + - - + - + + + + - + + + - - + - + - + + + + + + + + + + - + + + + + + + - - - + - - + - - + + + - - - + + + + + + + - + - - + - + + + - + - - + - - + + - + + + + - - + - + + - - + - + + + - - - + - + - ...
result:
ok 1000 lines