QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#270805 | #5158. Interview Question | ckiseki# | WA | 1ms | 3872kb | C++20 | 1.2kb | 2023-12-01 14:48:04 | 2023-12-01 14:48:04 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#define all(x) begin(x), end(x)
#ifdef CKISEKI
#define safe cerr << __PRETTY_FUNCTION__ << " line " << __LINE__ << " safe\n"
#define debug(a...) debug_(#a, a)
#define orange(a...) orange_(#a, a)
#include <experimental/iterator>
void debug_(auto s, auto ...a) {
cerr << "\e[1;32m(" << s << ") = (";
int f = 0;
(..., (cerr << (f++ ? ", " : "") << a));
cerr << ")\e[0m\n";
}
void orange_(auto s, auto L, auto R) {
cerr << "\e[1;33m[ " << s << " ] = [ ";
using namespace experimental;
copy(L, R, make_ostream_joiner(cerr, ", "));
cerr << " ]\e[0m\n";
}
#else
#define safe ((void)0)
#define debug(...) safe
#define orange(...) safe
#endif
int main() {
cin.tie(nullptr)->sync_with_stdio(false);
int c, d;
cin >> c >> d;
vector<int> fizz(d + 1);
vector<int> buzz(d + 1);
int gf = 0, gb = 0;
for (int i = c; i <= d; i++) {
string s;
cin >> s;
if (s == "Fizz") {
fizz[i] = true;
gf = gcd(gf, i);
} else if (s == "Buzz") {
buzz[i] = true;
gb = gcd(gb, i);
} else if (s == "FizzBuzz") {
fizz[i] = buzz[i] = true;
gf = gcd(gf, i);
gb = gcd(gb, i);
}
}
cout << gf << ' ' << gb << '\n';
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3576kb
input:
7 11 7 8 Fizz Buzz 11
output:
9 10
result:
ok
Test #2:
score: 0
Accepted
time: 1ms
memory: 3872kb
input:
49999 50002 49999 FizzBuzz 50001 Fizz
output:
2 50000
result:
ok
Test #3:
score: 0
Accepted
time: 0ms
memory: 3524kb
input:
8 11 Buzz Buzz FizzBuzz Buzz
output:
10 1
result:
ok
Test #4:
score: -100
Wrong Answer
time: 0ms
memory: 3580kb
input:
10 15 10 11 12 13 14 15
output:
0 0
result:
wrong answer Integer parameter [name=a] equals to 0, violates the range [1, 1000000]