QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#270805#5158. Interview Questionckiseki#WA 1ms3872kbC++201.2kb2023-12-01 14:48:042023-12-01 14:48:04

Judging History

你现在查看的是最新测评结果

  • [2023-12-01 14:48:04]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3872kb
  • [2023-12-01 14:48:04]
  • 提交

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]