General
 
 
# Author Problem Lang Verdict Time Memory Sent Judged  
113107284 Practice:
gyanendrarawat
1474B - 25 C++17 (GCC 7-32) Time limit exceeded on test 2 1000 ms 198004 KB 2021-04-15 18:17:20 2021-04-15 18:17:21
→ Source
#include<bits/stdc++.h>
using namespace std;

typedef unsigned int ui;
typedef unsigned long long ull;
typedef long long ll;

#define pB push_back
#define mP make_pair
#define vi vector <int> 
#define vii vector<vector<int>>
#define mset multiset <int> 
#define nl endl
#define iM INT_MAX
#define flag cout<<" Here "
#define deb(x) cout<<#x<<":"<<x<<nl
#define dbg(x,y) cout<<#x<<":"<<x<<" "<<#y<<":"<<y<<nl

const ll mod = 1e9 + 7;

vi v;

void sieve(int n)
{
    bool prime[n+1];
    memset(prime,true,sizeof(prime));

    for(int p=2;p*p<=n;p++)
    {
        if(prime[p])
        {

            for(int i=p*p;i<=n;i+=p)
            {
                prime[i]=false;
            }
        }
    
    }
    
    for (int p = 2; p <= n; p++)
		if (prime[p])
			v.push_back(p);
    
}

bool solve()
{   
    
    int d,i=0,j=-1;
    cin>>d;

    int len=v.size();

    for(i;i<len;i++)
    {
        if(v[i]-1<d)
        {
            // do nothing
        }

        else
        {
            break;
        }
    }       
    
    for(j=i;j<len;j++)
    {
        if(v[j]-v[i]<d)
        {
            // do nothing
        }
    
        else
        {
            break;
        }
    }

    cout<<v[i]*v[j]<<nl;

    return true;   
    
}


int main()       
{
      
    #ifndef ONLINE_JUDGE
        freopen("Input.txt","r",stdin);
        freopen("Output.txt","w",stdout);
    #endif
        
    ios_base::sync_with_stdio(false);
        cin.tie(NULL);
        cout.tie(NULL);

    /***************Write code here*******************/

    int tests;
    cin>>tests; 

    while(tests--)
    {   
        sieve(1000000);
        solve();

    }
        
    return 0;
}
?
Time: ? ms, memory: ? KB
Verdict: ?
Input
?
Participant's output
?
Jury's answer
?
Checker comment
?
Diagnostics
?
Click to see test details