# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
67936 | yusufake | Binary Subsequences (info1cup17_binary) | C++98 | 718 ms | 576 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define st first
#define nd second
typedef long long ll;
typedef pair < int , int > pp;
const int mod = 1e9 + 7;
const int N = 2e6 + 6;
pair < int , pp > ans;
int f(int x, int y){
if(x < y) swap(x,y);
int a=x; int b=y;
int t;
int zz=0;
for(; y ;){
t = x%y;
zz += x/y;
x = y;
y = t;
}
if(x==1)
ans = min(ans , mp(zz,mp(a,b)));
return x == 1;
}
int ww,k,t,i,x,y,zz,h;
int main(){
scanf("%d",&ww);
for(;ww--; puts("")){
scanf("%d",&k);
k += 2;
t = 0;
ans.st = mod;
zz = k/2;
for(i=1;i<=zz;i++){
t += 2*f(i,k-i);
}
if(k%2==0) t -= f(zz,zz);
printf("%d\n",t);
x = ans.nd.st;
y = ans.nd.nd;
for(; y ; h=!h){
t = x%y;
zz = x/y;
if(!t) zz--;
for(;zz--;) printf("%d ",h);
x = y;
y = t;
}
}
return 0;
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |