답안 #642935

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
642935 2022-09-20T21:27:55 Z danikoynov Present (RMI21_present) C++14
8 / 100
237 ms 16204 KB
/**
 ____ ____ ____ ____ ____ ____
||l |||e |||i |||n |||a |||d ||
||__|||__|||__|||__|||__|||__||
|/__\|/__\|/__\|/__\|/__\|/__\|

**/

#include<bits/stdc++.h>
#define endl '\n'

using namespace std;
typedef long long ll;

void speed()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
}

const int maxn = 1e5 + 10, maxnum = 150;
vector < vector < int > > st;
int gcd[maxnum][maxnum];
void preprocess()
{
    for (int i = 1; i < maxnum; i ++)
        for (int j = 1; j < maxnum; j ++)
            gcd[i][j] = __gcd(i, j);
    int mask = 0;
    while(st.size() < maxn)
    {
        vector < int > num;
        for (int bit = 0; (1 << bit) <= mask; bit ++)
            if ((mask & (1 << bit)))
                num.push_back(bit + 1);

        bool tf = true;
        for (int i = 0; i < num.size() && tf; i ++)
            for (int j = i + 1; j < num.size(); j ++)
            {
                int x = gcd[num[i]][num[j]];
                if ((mask & (1 << (x - 1))) == 0)
                {
                    tf = false;
                    break;
                }
            }

        if (tf)
        {
            st.push_back(num);
        }

        mask ++;
    }
    //cout << "Done " << mask << endl;
    //exit(0);
}

void solve()
{
    int n;
    cin >> n;
    cout << st[n].size();
    for (int v : st[n])
        cout << " " << v;
    cout << endl;

}

int main()
{
    preprocess();
    int t;
    cin >> t;
    while(t --)
        solve();
    return 0;
}

Compilation message

Main.cpp: In function 'void preprocess()':
Main.cpp:39:27: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   39 |         for (int i = 0; i < num.size() && tf; i ++)
      |                         ~~^~~~~~~~~~~~
Main.cpp:40:35: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   40 |             for (int j = i + 1; j < num.size(); j ++)
      |                                 ~~^~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 201 ms 7988 KB Output is correct
2 Correct 229 ms 8020 KB Output is correct
3 Correct 192 ms 8076 KB Output is correct
4 Correct 195 ms 8096 KB Output is correct
5 Correct 237 ms 8108 KB Output is correct
6 Correct 194 ms 7976 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 201 ms 7988 KB Output is correct
2 Correct 229 ms 8020 KB Output is correct
3 Correct 192 ms 8076 KB Output is correct
4 Correct 195 ms 8096 KB Output is correct
5 Correct 237 ms 8108 KB Output is correct
6 Correct 194 ms 7976 KB Output is correct
7 Runtime error 206 ms 16204 KB Execution killed with signal 11
8 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 201 ms 7988 KB Output is correct
2 Correct 229 ms 8020 KB Output is correct
3 Correct 192 ms 8076 KB Output is correct
4 Correct 195 ms 8096 KB Output is correct
5 Correct 237 ms 8108 KB Output is correct
6 Correct 194 ms 7976 KB Output is correct
7 Runtime error 206 ms 16204 KB Execution killed with signal 11
8 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 201 ms 7988 KB Output is correct
2 Correct 229 ms 8020 KB Output is correct
3 Correct 192 ms 8076 KB Output is correct
4 Correct 195 ms 8096 KB Output is correct
5 Correct 237 ms 8108 KB Output is correct
6 Correct 194 ms 7976 KB Output is correct
7 Runtime error 206 ms 16204 KB Execution killed with signal 11
8 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 201 ms 7988 KB Output is correct
2 Correct 229 ms 8020 KB Output is correct
3 Correct 192 ms 8076 KB Output is correct
4 Correct 195 ms 8096 KB Output is correct
5 Correct 237 ms 8108 KB Output is correct
6 Correct 194 ms 7976 KB Output is correct
7 Runtime error 206 ms 16204 KB Execution killed with signal 11
8 Halted 0 ms 0 KB -