QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#517997 | #4804. Regular Expression | cpchenpi# | WA | 5ms | 4260kb | C++20 | 1.1kb | 2024-08-13 15:06:34 | 2024-08-13 15:06:38 |
Judging History
answer
// https://www.youtube.com/watch?v=wthasN45KuY
// You said I’d fly away
// But my walls have kept me down
// Now I’m lost and I’m afraid
// And I’m close to hit the ground
//
// You said I’d fly away
// You said I’d fly anywhere
// But I keep on Falling
#ifndef ONLINE_JUDGE
#include "templates/debug.hpp"
#else
#define debug(...)
#endif
#include <bits/stdc++.h>
using namespace std;
using i64 = int64_t;
using u64 = uint64_t;
#define int i64
constexpr int INF = 1e9 + 7;
void solve() {
string s; cin >> s;
if (s.size() == 1) {
cout << 1 << " " << 2 << "\n";
} else if (s.size() == 2) {
cout << 2 << " ";
int ans = 6; // ab, .*, a., .b, ..,
if (s[0] == s[1]) ans += 2; // a*, a+
cout << ans << "\n";
} else {
cout << 2 << " ";
int ans = 1; // .*
if (s == string(s.size(), s[0])) ans += 2;
cout << ans << "\n";
}
}
#undef int
// Make bold hypotheses and verify carefully
int main() {
cin.tie(nullptr);
ios::sync_with_stdio(false);
int t = 1;
cin >> t;
while (t--) {
solve();
}
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3876kb
input:
2 a ab
output:
1 2 2 6
result:
ok 2 lines
Test #2:
score: -100
Wrong Answer
time: 5ms
memory: 4260kb
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 8 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 8 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 703rd lines differ - expected: '2 4', found: '2 3'