QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#501073#5158. Interview Question1DemonS1WA 0ms3784kbC++20954b2024-08-02 13:27:302024-08-02 13:27:30

Judging History

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

  • [2024-08-02 13:27:30]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3784kb
  • [2024-08-02 13:27:30]
  • 提交

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);
    if(a.size()==0) x=r+11;
    if(b.size()==0) y + r + 10; 
    cout<<x<<' '<<y<<'\n';
}

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

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

7 11
7 8 Fizz Buzz 11

output:

9 10

result:

ok 

Test #2:

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

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: 0
Accepted
time: 0ms
memory: 3592kb

input:

10 15
10 11 12 13 14 15

output:

16 17

result:

ok 

Test #5:

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

input:

17 17
17

output:

18 19

result:

ok 

Test #6:

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

input:

13 13
Fizz

output:

13 0

result:

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