QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#50172 | #4804. Regular Expression | bvd# | WA | 60ms | 3896kb | C++ | 625b | 2022-09-25 02:06:12 | 2022-09-25 02:06:13 |
Judging History
answer
#include <iostream>
#include <vector>
using namespace std;
#define rep(i,a,b) for (int i=a; i<(b); ++i)
#define sz(x) (int) (x).size()
const int maxn = 100000;
int t;
string s;
void solve() {
getline(cin, s);
if (sz(s) == 0) cout << 0 << ' ' << 1;
else if (sz(s) == 1) cout << 1 << ' ' << 2;
else if (sz(s) == 2) cout << 2 << ' ' << 6;
else {
rep(i,0,sz(s)-1) if (s[i]!=s[i+1]) {
cout << 2 << ' ' << 1;
return;
}
cout << 2 << ' ' << 3;
}
}
int main() {
ios_base::sync_with_stdio(0);
int t; cin >> t; getline(cin, s);
rep(i,0,t) {
solve();
cout << '\n';
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 2ms
memory: 3728kb
input:
2 a ab
output:
1 2 2 6
result:
ok 2 lines
Test #2:
score: -100
Wrong Answer
time: 60ms
memory: 3896kb
input:
35857 a b c d e f g h i j k l m n o p q r s t u v w x y z aa ab ac ad ae af ag ah ai aj ak al am an ao ap aq ar as at au av aw ax ay az ba bb bc bd be bf bg bh bi bj bk bl bm bn bo bp bq br bs bt bu bv bw bx by bz ca cb cc cd ce cf cg ch ci cj ck cl cm cn co cp cq cr cs ct cu cv cw cx cy cz da db dc...
output:
1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 2 6 2 6 2 6 2 6 2 6 2 6 2 6 2 6 2 6 2 6 2 6 2 6 2 6 2 6 2 6 2 6 2 6 2 6 2 6 2 6 2 6 2 6 2 6 2 6 2 6 2 6 2 6 2 6 2 6 2 6 2 6 2 6 2 6 2 6 2 6 2 6 2 6 2 6 2 6 2 6 2 6 2 6 2 6 2 6 2 6 2 6 2 6 2 6 2 6 ...
result:
wrong answer 27th lines differ - expected: '2 8', found: '2 6'