# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
291670 | kingfran1907 | Popcount (COCI19_popcount) | C++14 | 1 ms | 384 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#define X first
#define Y second
using namespace std;
typedef long long llint;
const int maxn = 2e5+10;
const int base = 31337;
const int mod = 1e9+7;
const int inf = 0x3f3f3f3f;
const int logo = 20;
const int off = 1 << logo;
const int treesiz = off << 1;
int n, k;
vector< int > v;
void rek(int x) {
if (x == v.size() - 1) printf("(1<<%d)", v[x]);
else {
printf("((1<<%d)+", v[x]);
rek(x + 1);
printf(")");
}
}
int main() {
scanf("%d%d", &n, &k);
int log = 0;
int tren = 1;
while (tren < n) log++, tren *= 2;
printf("%d\n", log);
for (int i = 0; i < log; i++) {
int ac = (1 << i);
printf("A=(");
printf("(A&");
v.clear();
for (int j = 0; j < n; j += ac * 2) {
for (int l = 0; l < ac; l++) {
if (l + j >= n) break;
v.push_back(j + l);
}
}
rek(0);
printf(")+");
v.clear();
for (int j = ac; j < n; j += ac * 2) {
int l = min(n, j + ac);
if (l == n) {
printf("((A&");
for (int x = j; x < l; x++)
v.push_back(x);
rek(0);
printf(")>>%d)", ac);
} else printf("((A&((1<<%d)-(1<<%d)))>>%d)", l, j, ac);
if (j + ac * 2 < n) printf("+");
}
printf(")\n");
}
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... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |