답안 #646657

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
646657 2022-09-30T11:30:21 Z ksu2009en Present (RMI21_present) C++14
8 / 100
1 ms 468 KB
#pragma GCC optimize("O3")

#include <iostream>
#include <vector>
#include <string>
#include <math.h>
#include <cmath>
#include <iomanip>
#include <cstdio>
#include <algorithm>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <deque>
#include <bitset>
#include <cstring>
#define endl '\n'

#include <unordered_map>

using namespace std;
typedef long long ll;

ll used[10001];

ll step = 0;

bool check(vector<ll>a){
    step++;
    
    for(auto i: a){
        used[i] = step;
        
        for(auto j: a){
            if(used[__gcd(i, j)] != step)
                return false;
        }
    }
    return true;
}

int main(){
    vector<vector<ll>>d(1001);
    
    int pos = 1;
    
    for(int num = 1; num <= 100; num++){
        d[pos++] = {num};
        
        ll last = pos - 1;
        
        for(int j = 1; j < last; j++){
            d[pos] = d[j];
            d[pos].push_back(num);
            
            if(!check(d[pos]))
                continue;
            pos++;
            
            if(pos >= 110)
                break;
        }
        if(pos >= 100)
            break;
    }
    
    ll t;
    cin >> t;
    
    while(t--){
        ll n;
        cin >> n;
        
        cout << d[n].size() << ' ';
        for(auto i: d[n])
            cout << i << ' ';
        cout << endl;
    }
    
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 0 ms 336 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 1 ms 332 KB Output is correct
6 Correct 0 ms 340 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 0 ms 336 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 1 ms 332 KB Output is correct
6 Correct 0 ms 340 KB Output is correct
7 Runtime error 1 ms 468 KB Execution killed with signal 11
8 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 0 ms 336 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 1 ms 332 KB Output is correct
6 Correct 0 ms 340 KB Output is correct
7 Runtime error 1 ms 468 KB Execution killed with signal 11
8 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 0 ms 336 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 1 ms 332 KB Output is correct
6 Correct 0 ms 340 KB Output is correct
7 Runtime error 1 ms 468 KB Execution killed with signal 11
8 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 0 ms 336 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 1 ms 332 KB Output is correct
6 Correct 0 ms 340 KB Output is correct
7 Runtime error 1 ms 468 KB Execution killed with signal 11
8 Halted 0 ms 0 KB -