/ SeriousOJ /

Record Detail

Wrong Answer


  
# Status Time Cost Memory Cost
#1 Accepted 2ms 1.062 MiB
#2 Wrong Answer 11ms 1.449 MiB
#3 Wrong Answer 11ms 1.641 MiB

Code

#include<bits/stdc++.h>
#define endl        '\n'
#define F           first
#define S           second
#define pb          push_back
#define yes         cout<<"YES\n"
#define no          cout<<"NO\n"
#define all(x)      x.begin(),x.end()
#define allr(x)     x.rbegin(),x.rend()
#define error1(x)   cerr<<#x<<" = "<<(x)<<endl
#define error2(a,b) cerr<<"("<<#a<<", "<<#b<<") = ("<<(a)<<", "<<(b)<<")\n";
#define coutall(v)  for(auto &it: v) cout << it << " "; cout << endl;
using namespace std;
using ll = long long;
using ld = long double;

const int N = 1e5 + 7;
int marked[N / 64 + 2];

#define on(x) (marked[x / 64] & (1 << ((x % 64) / 2)))
#define mark(x) marked[x / 64] |= (1 << ((x % 64) / 2))

void sieve() {
    for (int i = 3; i * i < N; i += 2) {
        if (!on(i)) {
            for (int j = i * i; j <= N; j += i + i) {
                mark(j);
            }
        }
    }
}

bool isPrime(int num) {
    return num > 1 && (num == 2 || ((num & 1) && !on(num)));
}

vector<ll> pr;

void solve() {
    ll n;
    cin >> n;
    vector<ll> v(n);
    v[0] = 2 * 3;
    v[1] = 5 * 3;
    int pos = 0; // 
    for(int i = 2; i < n; i++, ++pos) {
        while(pr[pos] == 3 or pr[pos] == 5) ++pos; 
        v[i] = 2LL * 5LL * pr[pos];
    }
    sort(all(v));
    coutall(v);
    // auto check = [&] () -> bool {
    //     ll tmp = v[0];
    //     for(int i = 0; i < n; i++) {
    //         for(int j = i + 1; j < n; j++) {
    //             if(__gcd(v[i], v[j]) == 1) {
    //                 cout << i << " " << j << endl; 
    //                 return 0;
    //             }
    //         }
    //         tmp = __gcd(tmp, v[i]);
    //     }
    //     return tmp == 1;
    // };

    // if(check()) yes;
    // else no;
    return;
}

signed main() {
    ios::sync_with_stdio(false); cin.tie(0);
    int tc = 1;
    pr.pb(1);
    for(int i = 2; i <= N; i++) {
        if(isPrime(i)) pr.pb(i);
    }
    cin >> tc;
    for (int t = 1; t <= tc; t++) {
        // cout << "Case " << t << ": ";
        solve();
    }
    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 17:02:01
Judged At
2024-11-11 03:23:15
Judged By
Score
10
Total Time
11ms
Peak Memory
1.641 MiB