Submission #737098

# Submission time Handle Problem Language Result Execution time Memory
737098 2023-05-06T15:45:47 Z ibm2006 Present (RMI21_present) C++14
8 / 100
556 ms 35336 KB
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
ll n,i,x,y,t,j,a[110000],m,k;
vector<ll> v,u[1100000],q;
ll gcd(ll x,ll y)
{
    if(x>y)
        x^=y^=x^=y;
    if(y%x==0)
        return x;
    return gcd(y%x,x);
}
int main()
{

    for(i=0;1;i++)
    {
        if(t==100001)
            break;
            v.clear();
            q.clear();
        x=i; y=0;
        while(x>0)
        {
            v.push_back(x%2);
            if(x%2==1)
                q.push_back(y+1);
            x/=2;
            y++;

        }
        for(j=y-1;j>=0;j--)
            {a[j+1]=v[j];  /*printf("%lld:%lld ",j+1,a[j+1]);*/  }
        if(i==0)
        {
            u[t]=q;
            t++;
            continue;
        }
        for(j=1;j<=y;j++)
            for(k=j+1;k<=y;k++)
        {
            if(a[j]==0||a[k]==0)
                continue;
            if(a[gcd(j,k)]==0)
            {
                x=-1;
               // printf("!");
                break;
            }
        }
        //printf("%lld %lld\n",i,x);
        if(x==0)
        {
            u[t]=q;
            t++;
            continue;
        }
    }
    //printf("!");
    //return 0;
    scanf("%lld",&n);
    for(i=1;i<=n;i++)
    {
        scanf("%lld",&x);
        printf("%lld ",u[x].size());
        m=u[x].size();
        for(j=0;j<m;j++)
            printf("%lld ",u[x][j]);
        printf("\n");
    }
}

Compilation message

Main.cpp: In function 'int main()':
Main.cpp:19:9: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
   19 |         if(t==100001)
      |         ^~
Main.cpp:21:13: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
   21 |             v.clear();
      |             ^
Main.cpp:67:20: warning: format '%lld' expects argument of type 'long long int', but argument 2 has type 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wformat=]
   67 |         printf("%lld ",u[x].size());
      |                 ~~~^   ~~~~~~~~~~~
      |                    |            |
      |                    |            std::vector<long long int>::size_type {aka long unsigned int}
      |                    long long int
      |                 %ld
Main.cpp:63:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   63 |     scanf("%lld",&n);
      |     ~~~~~^~~~~~~~~~~
Main.cpp:66:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   66 |         scanf("%lld",&x);
      |         ~~~~~^~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 547 ms 35324 KB Output is correct
2 Correct 555 ms 35256 KB Output is correct
3 Correct 556 ms 35164 KB Output is correct
4 Correct 552 ms 35276 KB Output is correct
5 Correct 556 ms 35336 KB Output is correct
6 Correct 552 ms 35232 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 547 ms 35324 KB Output is correct
2 Correct 555 ms 35256 KB Output is correct
3 Correct 556 ms 35164 KB Output is correct
4 Correct 552 ms 35276 KB Output is correct
5 Correct 556 ms 35336 KB Output is correct
6 Correct 552 ms 35232 KB Output is correct
7 Incorrect 551 ms 35244 KB Output isn't correct
8 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 547 ms 35324 KB Output is correct
2 Correct 555 ms 35256 KB Output is correct
3 Correct 556 ms 35164 KB Output is correct
4 Correct 552 ms 35276 KB Output is correct
5 Correct 556 ms 35336 KB Output is correct
6 Correct 552 ms 35232 KB Output is correct
7 Incorrect 551 ms 35244 KB Output isn't correct
8 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 547 ms 35324 KB Output is correct
2 Correct 555 ms 35256 KB Output is correct
3 Correct 556 ms 35164 KB Output is correct
4 Correct 552 ms 35276 KB Output is correct
5 Correct 556 ms 35336 KB Output is correct
6 Correct 552 ms 35232 KB Output is correct
7 Incorrect 551 ms 35244 KB Output isn't correct
8 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 547 ms 35324 KB Output is correct
2 Correct 555 ms 35256 KB Output is correct
3 Correct 556 ms 35164 KB Output is correct
4 Correct 552 ms 35276 KB Output is correct
5 Correct 556 ms 35336 KB Output is correct
6 Correct 552 ms 35232 KB Output is correct
7 Incorrect 551 ms 35244 KB Output isn't correct
8 Halted 0 ms 0 KB -