Submission #74350636


Source Code Expand

#include <bits/stdc++.h>
#include<math.h>
using namespace std;
typedef long double ld;
typedef long long ll;
typedef vector<long long> vll;
#pragma GCC optimize("O3,unroll-loops")
#pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt")
#define endl '\n'
ll mod = 1e9+7 ;
int p1 = 31 , p2 = 91 ;
ll mod1= 1e9+7 , mod2 = 1e9+9 ;
const double PI = acos(-1) ;
using cd = complex<double> ;
std::mt19937_64 rng(std::chrono::steady_clock::now().time_since_epoch().count());
struct base {
    double a, b;
    base(double a = 0, double b = 0) : a(a), b(b) {}
    const base operator + (const base &c) const
    { return base(a + c.a, b + c.b); }
    const base operator - (const base &c) const
    { return base(a - c.a, b - c.b); }
    const base operator * (const base &c) const
    { return base(a * c.a - b * c.b, a * c.b + b * c.a); }
};
void fft(vector<base> &p, bool inv = 0) {
    int n = p.size(), i = 0;
    for(int j = 1; j < n - 1; ++j) {
        for(int k = n >> 1; k > (i ^= k); k >>= 1);
        if(j < i) swap(p[i], p[j]);
    }
    for(int l = 1, m; (m = l << 1) <= n; l <<= 1) {
        double ang = 2 * PI / m;
        base wn = base(cos(ang), (inv ? 1. : -1.) * sin(ang)), w;
        for(int i = 0, j, k; i < n; i += m) {
            for(w = base(1, 0), j = i, k = i + l; j < k; ++j, w = w * wn) {
                base t = w * p[j + l];
                p[j + l] = p[j] - t;
                p[j] = p[j] + t;
            }
        }
    }
    if(inv) for(int i = 0; i < n; ++i) p[i].a /= n, p[i].b /= n;
}
vector<long long> multiply(vector<int> &a, vector<int> &b) {
    int n = a.size(), m = b.size(), t = n + m - 1, sz = 1;
    while(sz < t) sz <<= 1;
    vector<base> x(sz), y(sz), z(sz);
    for(int i = 0 ; i < sz; ++i) {
        x[i] = i < (int)a.size() ? base(a[i], 0) : base(0, 0);
        y[i] = i < (int)b.size() ? base(b[i], 0) : base(0, 0);
    }
    fft(x), fft(y);
    for(int i = 0; i < sz; ++i) z[i] = x[i] * y[i];
    fft(z, 1);
    vector<long long> ret(sz);
    for(int i = 0; i < sz; ++i) ret[i] = (long long) round(z[i].a);
    while((int)ret.size() > 1 && ret.back() == 0) ret.pop_back();
    return ret;
}

void solve() {
    int v , a, b ,c ; cin >> v >> a >> b >> c ;
    v= v%(a+b+c);
    if(a>v) cout <<'F' << endl ;
    else {
        if(a+b>v) cout <<'M' << endl ;
        else {
            if(b+c+a>v) cout <<'T' << endl ;
            else cout << 'F'<< endl;
        }
    }

}




int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int t = 1;
    //cin >> t;
    while (t--) {
        solve();
    }
    return 0;
}

Submission Info

Submission Time
Task A - Shampoo
User Code_Pro
Language C++23 (GCC 15.2.0)
Score 100
Code Size 2661 Byte
Status AC
Exec Time 1 ms
Memory 3600 KiB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 100 / 100
Status
AC × 3
AC × 11
Set Name Test Cases
Sample sample_01.txt, sample_02.txt, sample_03.txt
All random_01.txt, random_02.txt, random_03.txt, random_04.txt, random_05.txt, random_06.txt, random_07.txt, random_08.txt, sample_01.txt, sample_02.txt, sample_03.txt
Case Name Status Exec Time Memory
random_01.txt AC 1 ms 3596 KiB
random_02.txt AC 1 ms 3436 KiB
random_03.txt AC 1 ms 3392 KiB
random_04.txt AC 1 ms 3436 KiB
random_05.txt AC 1 ms 3596 KiB
random_06.txt AC 1 ms 3540 KiB
random_07.txt AC 1 ms 3436 KiB
random_08.txt AC 1 ms 3400 KiB
sample_01.txt AC 1 ms 3464 KiB
sample_02.txt AC 1 ms 3400 KiB
sample_03.txt AC 1 ms 3600 KiB