QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#96267 | #5158. Interview Question | Sa3tElSefr# | WA | 45ms | 16916kb | C++14 | 3.4kb | 2023-04-13 18:15:44 | 2023-04-13 18:15:45 |
Judging History
answer
///Etfsh5t nseet el rank
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("avx,avx2,fma")
#include "bits/stdc++.h"
using namespace std;
#define pb push_back
#define F first
#define S second
#define f(i, a, b) for (int i = a; i < b; i++)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define sz(x) (int)(x).size()
#define mp(x, y) make_pair(x, y)
#define popCnt(x) (__builtin_popcountll(x))
// #define int ll
using ll = long long;
using ull = unsigned long long;
using uint = uint32_t;
using ii = pair<int, int>;
const int N = 3e5 + 5, A = 12, LG = 18, MOD = (119 << 23) + 1;
const long double PI = acos(-1);
const long double EPS = 1e-9;
const int INF = 1e18;
vector<int> divos[100005];
string val[100005];
void doWork()
{
int c, d;
cin >> c >> d;
vector<int> vec1, vec2;
for (int i = c; i <= d; i++)
{
cin >> val[i];
}
f(i, c, d + 1)
{
if (val[i] == "Fizz" || val[i] == "FizzBuzz")
{
vec1 = divos[i];
break;
}
}
f(i, c, d + 1)
{
if (val[i] == "Buzz" || val[i] == "FizzBuzz")
{
vec2 = divos[i];
break;
}
}
f(i, c, d + 1)
{
vector<int> n_vec1, n_vec2;
if (val[i] == "Fizz")
{
for (auto x : vec1)
{
if (i % x == 0)
{
n_vec1.push_back(x);
}
}
for (auto x : vec2)
{
if (i % x != 0)
{
n_vec2.push_back(x);
}
}
}
else if (val[i] == "Buzz")
{
for (auto x : vec1)
{
if (i % x != 0)
{
n_vec1.push_back(x);
}
}
for (auto x : vec2)
{
if (i % x == 0)
{
n_vec2.push_back(x);
}
}
}
else if (val[i] == "FizzBuzz")
{
for (auto x : vec1)
{
if (i % x == 0)
{
n_vec1.push_back(x);
}
}
for (auto x : vec2)
{
if (i % x == 0)
{
n_vec2.push_back(x);
}
}
}
else
{
for (auto x : vec1)
{
if (i % x != 0)
{
n_vec1.push_back(x);
}
}
for (auto x : vec2)
{
if (i % x != 0)
{
n_vec2.push_back(x);
}
}
}
vec1 = n_vec1;
vec2 = n_vec2;
}
vec1.push_back(10000000);
vec2.push_back(10000000);
cout << vec1[0] << ' ' << vec2[0] << endl;
}
int32_t main()
{
#ifdef ONLINE_JUDGE
ios_base::sync_with_stdio(0);
cin.tie(0);
#endif // ONLINE_JUDGE
for (int i = 1; i <= 100000; i++)
for (int j = i; j <= 100000; j += i)
divos[j].push_back(i);
int t = 1;
// cin >> t;
while (t--)
{
doWork();
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 32ms
memory: 16896kb
input:
7 11 7 8 Fizz Buzz 11
output:
3 5
result:
ok
Test #2:
score: 0
Accepted
time: 44ms
memory: 16916kb
input:
49999 50002 49999 FizzBuzz 50001 Fizz
output:
2 4
result:
ok
Test #3:
score: 0
Accepted
time: 28ms
memory: 16896kb
input:
8 11 Buzz Buzz FizzBuzz Buzz
output:
5 1
result:
ok
Test #4:
score: -100
Wrong Answer
time: 45ms
memory: 16804kb
input:
10 15 10 11 12 13 14 15
output:
10000000 10000000
result:
wrong answer Integer parameter [name=a] equals to 10000000, violates the range [1, 1000000]