Submission #49469461
Source Code Expand
#include<bits/stdc++.h>
using namespace std;
#ifdef LOCAL
#define debug(...) fprintf(stdout, ##__VA_ARGS__)
#else
#define debug(...) void(0)
#endif
//#define int long long
inline int read(){int x=0,f=1;char ch=getchar();
while(ch<'0'||ch>'9'){if(ch=='-')f=-1;
ch=getchar();}while(ch>='0'&&ch<='9'){x=(x<<1)+
(x<<3)+(ch^48);ch=getchar();}return x*f;}
#define Z(x) (x)*(x)
#define pb push_back
#define fi first
#define se second
//#define M
//#define mo
//#define N
int n, m, i, j, k, T;
char s[10010];
signed main()
{
// #ifdef LOCAL
// freopen("in.txt", "r", stdin);
// freopen("out.txt", "w", stdout);
// #endif
// srand(time(NULL));
// T=read();
// while(T--) {
//
// }
n = read(); m = log2(n) + 1;
if(n == (1 << m - 1)) --m;
printf("%d", m); cout << endl;
for(i = 0; i < m; ++i) {
k = 0;
for(j = 1; j <= n; ++j)
if(j & (1 << i)) ++k;
printf("%d ", k);
for(j = 1; j <= n; ++j)
if(j & (1 << i)) printf("%d ", j);
// printf("\n");
cout<<endl;
}
scanf("%s", s);
for(i = k = 0; i < m; ++i) if(s[i] == '1') k |= (1 << i);
if(k == 0) k = n;
printf("%d", k); cout<<endl;
return 0;
}
Submission Info
| Submission Time | |
|---|---|
| Task | E - Bad Juice |
| User | zhangtingxi |
| Language | C++ 20 (gcc 12.2) |
| Score | 425 |
| Code Size | 1182 Byte |
| Status | AC |
| Exec Time | 3 ms |
| Memory | 3900 KiB |
Compile Error
Main.cpp: In function ‘int main()’:
Main.cpp:35:25: warning: suggest parentheses around ‘-’ inside ‘<<’ [-Wparentheses]
35 | if(n == (1 << m - 1)) --m;
| ~~^~~
Main.cpp:47:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
47 | scanf("%s", s);
| ~~~~~^~~~~~~~~
Judge Result
| Set Name | Sample | All | ||||
|---|---|---|---|---|---|---|
| Score / Max Score | 0 / 0 | 425 / 425 | ||||
| Status |
|
|
| Set Name | Test Cases |
|---|---|
| Sample | example0.txt |
| All | 000.txt, 001.txt, 002.txt, 003.txt, 004.txt, 005.txt, 006.txt, 007.txt, 008.txt, 009.txt, 010.txt, 011.txt, 012.txt, 013.txt, 014.txt, 015.txt, 016.txt, 017.txt, 018.txt, 019.txt, 020.txt, 021.txt, 022.txt, 023.txt, 024.txt, example0.txt |
| Case Name | Status | Exec Time | Memory |
|---|---|---|---|
| 000.txt | AC | 3 ms | 3820 KiB |
| 001.txt | AC | 3 ms | 3836 KiB |
| 002.txt | AC | 3 ms | 3784 KiB |
| 003.txt | AC | 2 ms | 3836 KiB |
| 004.txt | AC | 2 ms | 3788 KiB |
| 005.txt | AC | 2 ms | 3708 KiB |
| 006.txt | AC | 2 ms | 3784 KiB |
| 007.txt | AC | 2 ms | 3784 KiB |
| 008.txt | AC | 3 ms | 3896 KiB |
| 009.txt | AC | 3 ms | 3784 KiB |
| 010.txt | AC | 3 ms | 3788 KiB |
| 011.txt | AC | 3 ms | 3880 KiB |
| 012.txt | AC | 2 ms | 3896 KiB |
| 013.txt | AC | 3 ms | 3856 KiB |
| 014.txt | AC | 2 ms | 3740 KiB |
| 015.txt | AC | 2 ms | 3880 KiB |
| 016.txt | AC | 2 ms | 3840 KiB |
| 017.txt | AC | 2 ms | 3840 KiB |
| 018.txt | AC | 3 ms | 3824 KiB |
| 019.txt | AC | 2 ms | 3852 KiB |
| 020.txt | AC | 3 ms | 3804 KiB |
| 021.txt | AC | 3 ms | 3784 KiB |
| 022.txt | AC | 3 ms | 3776 KiB |
| 023.txt | AC | 3 ms | 3800 KiB |
| 024.txt | AC | 2 ms | 3900 KiB |
| example0.txt | AC | 3 ms | 3900 KiB |