답안 #579971

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
579971 2022-06-20T12:04:50 Z FatihSolak Present (RMI21_present) C++17
29 / 100
3468 ms 166316 KB
#include <bits/stdc++.h>
#define N 1000005
using namespace std;
vector<short> v[N];
bool can(vector<short> a,short x){
    bool ok = 1;
    for(auto u:a){
        bool now = 0;
        for(auto c:a){
            if(__gcd(u,x) == c)
                now = 1;
        }
        ok &= now;
    }
    return ok;
}
void solve(){
    int k;
    cin >> k;
    cout << v[k].size() << " ";
    for(auto u:v[k]){
        cout << u << " ";
    }
    cout << "\n";
}

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    #ifdef Local
        freopen("in.txt","r",stdin);
        freopen("out.txt","w",stdout);
    #endif
    int cnt = 0;
    for(int i = 1;i<=50;i++){
        int tmp = cnt;
        for(int j = 0;j<=tmp && cnt + 1 < N ;j++){
            if(can(v[j],i)){
                cnt++;
                v[cnt] = v[j];
                v[cnt].push_back(i);
            }
        }
        //cout << cnt << endl;
    }
    int t = 1;
    cin >> t;
    while(t--){
        solve();
    }
    #ifdef Local
        cout << endl << fixed << setprecision(2) << 1000.0*clock()/CLOCKS_PER_SEC << " milliseconds.";
    #endif
}
# 결과 실행 시간 메모리 Grader output
1 Correct 3360 ms 82120 KB Output is correct
2 Correct 3437 ms 82124 KB Output is correct
3 Correct 3413 ms 82132 KB Output is correct
4 Correct 3357 ms 82056 KB Output is correct
5 Correct 3371 ms 82160 KB Output is correct
6 Correct 3365 ms 82080 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3360 ms 82120 KB Output is correct
2 Correct 3437 ms 82124 KB Output is correct
3 Correct 3413 ms 82132 KB Output is correct
4 Correct 3357 ms 82056 KB Output is correct
5 Correct 3371 ms 82160 KB Output is correct
6 Correct 3365 ms 82080 KB Output is correct
7 Correct 3377 ms 82120 KB Output is correct
8 Correct 3341 ms 82236 KB Output is correct
9 Correct 3354 ms 82120 KB Output is correct
10 Correct 3432 ms 82256 KB Output is correct
11 Correct 3398 ms 82192 KB Output is correct
12 Correct 3357 ms 82112 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3360 ms 82120 KB Output is correct
2 Correct 3437 ms 82124 KB Output is correct
3 Correct 3413 ms 82132 KB Output is correct
4 Correct 3357 ms 82056 KB Output is correct
5 Correct 3371 ms 82160 KB Output is correct
6 Correct 3365 ms 82080 KB Output is correct
7 Correct 3377 ms 82120 KB Output is correct
8 Correct 3341 ms 82236 KB Output is correct
9 Correct 3354 ms 82120 KB Output is correct
10 Correct 3432 ms 82256 KB Output is correct
11 Correct 3398 ms 82192 KB Output is correct
12 Correct 3357 ms 82112 KB Output is correct
13 Runtime error 3468 ms 166316 KB Execution killed with signal 11
14 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 3360 ms 82120 KB Output is correct
2 Correct 3437 ms 82124 KB Output is correct
3 Correct 3413 ms 82132 KB Output is correct
4 Correct 3357 ms 82056 KB Output is correct
5 Correct 3371 ms 82160 KB Output is correct
6 Correct 3365 ms 82080 KB Output is correct
7 Correct 3377 ms 82120 KB Output is correct
8 Correct 3341 ms 82236 KB Output is correct
9 Correct 3354 ms 82120 KB Output is correct
10 Correct 3432 ms 82256 KB Output is correct
11 Correct 3398 ms 82192 KB Output is correct
12 Correct 3357 ms 82112 KB Output is correct
13 Runtime error 3468 ms 166316 KB Execution killed with signal 11
14 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 3360 ms 82120 KB Output is correct
2 Correct 3437 ms 82124 KB Output is correct
3 Correct 3413 ms 82132 KB Output is correct
4 Correct 3357 ms 82056 KB Output is correct
5 Correct 3371 ms 82160 KB Output is correct
6 Correct 3365 ms 82080 KB Output is correct
7 Correct 3377 ms 82120 KB Output is correct
8 Correct 3341 ms 82236 KB Output is correct
9 Correct 3354 ms 82120 KB Output is correct
10 Correct 3432 ms 82256 KB Output is correct
11 Correct 3398 ms 82192 KB Output is correct
12 Correct 3357 ms 82112 KB Output is correct
13 Runtime error 3468 ms 166316 KB Execution killed with signal 11
14 Halted 0 ms 0 KB -