Submission #737098

#TimeUsernameProblemLanguageResultExecution timeMemory
737098ibm2006Present (RMI21_present)C++14
8 / 100
556 ms35336 KiB
#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 (stderr)

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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...