/ SeriousOJ /

Record Detail

Wrong Answer


  
# Status Time Cost Memory Cost
#1 Accepted 3ms 920.0 KiB
#2 Wrong Answer 10ms 1.418 MiB
#3 Wrong Answer 11ms 1.441 MiB

Code

#include <bits/stdc++.h> 
using namespace std;
 
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 

typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> p64;
typedef vector<ll> v64;
typedef vector<p64> vp64;
ll mod = 1e9+7;
const ll N = 500005;
double eps = 1e-12;
ll dr[] = {1,-1,0,0};
ll dc[] = {0,0,1,-1};
#define forn(i,e) for(ll i = 0; i < e; i++)
#define rforn(i,s) for(ll i = s; i >= 0; i--)
#define pb push_back
#define fi first
#define se second
#define nn "\n"
#define inf 2e18
#define setbit(x,k) (x|= (1LL<<k))
#define checkbit(x,k) ((x>>k)&1)
#define clearbit(x,k) (x&= ~(1LL<<k))
#define yes cout << "YES\n"
#define no cout << "NO\n"
#define fast_cin() ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define all(x) (x).begin(), (x).end()
#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update>

#define M 300000
bitset <M> primes;
void sieve(){
    primes[0]=true,primes[1]=true;
    for(ll i=2;i*i<=M;i++){
        if(primes[i]==false){
            for(ll j=i*i;j<M;j+=i){
                primes[j]=true;
            }
        }
    }
}

vector<ll> prime;

void solve(ll t){
    ll n,m,temp,ans=0,i,j,k,a,b,c,u,v;
    
    cin>>n;
    ans = 1;
    for(i = 0; i<n-1; i++){
        cout << prime[0]*prime[i+1] << " ";
        ans*=(prime[i+1]);
    }
    cout << ans << nn;

    
}
int main()
{
    fast_cin();
    sieve();
    ll t = 1;
    cin >> t;
    for(ll i= 2;i<M; i++){
        if(primes[i]==false){
            prime.pb(i);
            // cout << i << " ";
        }
    }
    for(int it=1;it<=t;it++) {
        solve(it);
    }
    return 0;
}

Information

Submit By
Type
Submission
Problem
P1070 Strange Sequences
Contest
Brain Booster #4
Language
C++20 (G++ 13.2.0)
Submit At
2024-07-14 16:48:45
Judged At
2024-11-11 03:23:31
Judged By
Score
10
Total Time
11ms
Peak Memory
1.441 MiB