/ SeriousOJ /

Record Detail

Memory Exceeded


  
# Status Time Cost Memory Cost
#1 Accepted 1ms 532.0 KiB
#2 Memory Exceeded ≥1025ms ≥32.016 MiB
#3 Memory Exceeded ≥1014ms ≥32.016 MiB

Code

#include <bits/stdc++.h>
using namespace std;
int main()
{
    int t;
    cin >> t;
    while (t--)
    {
        int a, b, c, x;
        cin >> a >> b >> c >> x;
        vector<int> v;
        for (int i = 1; i < x; i++)
        {
            if (i % a == 0 && i % b == 0 && i % c == 0)
            {
                v.push_back(i);
            }
        }
        auto m = max_element(v.begin(), v.end());
        if (m != v.end())
        {
            cout << *m << endl;
        }
        else
        {
            cout << -1 << endl;
        }
    }
    return 0;
}

Information

Submit By
Type
Submission
Problem
P1025 GCM
Contest
Brain booster #2
Language
C++20 (G++ 13.2.0)
Submit At
2024-03-06 13:20:49
Judged At
2024-11-11 03:42:39
Judged By
Score
2
Total Time
≥1025ms
Peak Memory
≥32.016 MiB