QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#501071#5158. Interview Question1DemonS1WA 0ms3616kbC++20949b2024-08-02 13:25:552024-08-02 13:25:56

Judging History

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

  • [2024-08-02 13:25:56]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3616kb
  • [2024-08-02 13:25:55]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
#define ll long long
const int N = 2e5 + 9;
const int mod = 1e9 + 7;
#define eps 1e-5
#define inf 2e18



void solve()
{
    vector<int> a, b;
    bool ok = true;
    string s;
    int l, r; cin >> l >> r;
    for (int i = l; i <= r; ++i)
    {
        cin >> s;
        if (s[0] == 'F' || s[0] == 'B')
        {
            ok = false;
            if (s == "Fizz") a.push_back(i);
            else if (s == "Buzz") b.push_back(i);
            else a.push_back(i), b.push_back(i);
        }
    }

    if (ok)
    {
        cout << r + 1 << ' ' << r + 2 << '\n';
        return;
    }

    int x = 0, y = 0;
    for (auto& i : a) x = __gcd(x, i);
    for (auto& i : b) y = __gcd(y, i);
    cout << x << ' ' << y << '\n';
}

int main()
{
    ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    int _ = 1; // cin>>_;
    while (_--) solve();
    return 0;
}

详细

Test #1:

score: 100
Accepted
time: 0ms
memory: 3616kb

input:

7 11
7 8 Fizz Buzz 11

output:

9 10

result:

ok 

Test #2:

score: 0
Accepted
time: 0ms
memory: 3528kb

input:

49999 50002
49999 FizzBuzz 50001 Fizz

output:

2 50000

result:

ok 

Test #3:

score: 0
Accepted
time: 0ms
memory: 3424kb

input:

8 11
Buzz Buzz FizzBuzz Buzz

output:

10 1

result:

ok 

Test #4:

score: 0
Accepted
time: 0ms
memory: 3552kb

input:

10 15
10 11 12 13 14 15

output:

16 17

result:

ok 

Test #5:

score: 0
Accepted
time: 0ms
memory: 3480kb

input:

17 17
17

output:

18 19

result:

ok 

Test #6:

score: -100
Wrong Answer
time: 0ms
memory: 3608kb

input:

13 13
Fizz

output:

13 0

result:

wrong answer Integer parameter [name=b] equals to 0, violates the range [1, 1000000]