Submission #290905

# Submission time Handle Problem Language Result Execution time Memory
290905 2020-09-04T14:30:54 Z Plurm "The Lyuboyn" code (IZhO19_lyuboyn) C++11
19 / 100
1000 ms 34296 KB
#include <bits/stdc++.h>
using namespace std;
int lsb[300005];
int rmp[300005];
set<string> s;
int main(){
	int n,k,t;
	scanf("%d%d%d",&n,&k,&t);
	if(k % 2 == 0 || k >= n){
		printf("-1\n");
		return 0;
	}
	for(int i = 0; i <= 18; i++) rmp[1 << i] = i;
	printf("%d\n", 1 << n);
	char bs[32];
	scanf("%s",bs);
	if(strlen(bs) != n) while(true);
	int parsed = 0;
	for(int i = 0; i < n; i++){
		parsed *= 2;
		parsed += bs[i] == '1' ? 1 : 0;
	}
	printf("%s\n",bs);
	s.insert(bs);
	for(int i = 1; i < (1 << n); i++){
		int bit = rmp[i & -i];
		for(int j = 0; j < k; j++){
			int toggidx = (bit+j) % n;
			bs[n-toggidx-1] = '0'+'1'-bs[n-toggidx-1];
		}
      if(s.count(string(bs))) while(true);
		printf("%s\n",bs);
		s.insert(bs);
	}
	return 0;
}

Compilation message

lyuboyn.cpp: In function 'int main()':
lyuboyn.cpp:17:16: warning: comparison of integer expressions of different signedness: 'size_t' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   17 |  if(strlen(bs) != n) while(true);
      |     ~~~~~~~~~~~^~~~
lyuboyn.cpp:31:31: warning: this 'while' clause does not guard... [-Wmisleading-indentation]
   31 |       if(s.count(string(bs))) while(true);
      |                               ^~~~~
lyuboyn.cpp:32:3: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'while'
   32 |   printf("%s\n",bs);
      |   ^~~~~~
lyuboyn.cpp:8:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
    8 |  scanf("%d%d%d",&n,&k,&t);
      |  ~~~~~^~~~~~~~~~~~~~~~~~~
lyuboyn.cpp:16:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   16 |  scanf("%s",bs);
      |  ~~~~~^~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 384 KB Ok
# Verdict Execution time Memory Grader output
1 Correct 0 ms 384 KB Ok
# Verdict Execution time Memory Grader output
1 Correct 0 ms 256 KB Ok
2 Correct 0 ms 384 KB Ok
3 Correct 0 ms 256 KB Ok
4 Correct 0 ms 256 KB Ok
5 Correct 0 ms 384 KB Ok
6 Correct 1 ms 384 KB Ok
7 Correct 0 ms 384 KB Ok
8 Correct 0 ms 384 KB Ok
# Verdict Execution time Memory Grader output
1 Correct 242 ms 34072 KB Ok
2 Correct 116 ms 17144 KB Ok
3 Correct 1 ms 384 KB Ok
4 Correct 0 ms 384 KB Ok
5 Correct 1 ms 384 KB Ok
# Verdict Execution time Memory Grader output
1 Correct 1 ms 384 KB Ok
2 Correct 6 ms 1152 KB Ok
3 Correct 127 ms 17144 KB Ok
4 Correct 63 ms 8696 KB Ok
5 Execution timed out 1095 ms 384 KB Time limit exceeded
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 351 ms 34168 KB Ok
2 Correct 294 ms 34168 KB Ok
3 Execution timed out 1086 ms 8824 KB Time limit exceeded
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 242 ms 34072 KB Ok
2 Correct 116 ms 17144 KB Ok
3 Correct 1 ms 384 KB Ok
4 Correct 0 ms 384 KB Ok
5 Correct 1 ms 384 KB Ok
6 Correct 1 ms 384 KB Ok
7 Correct 6 ms 1152 KB Ok
8 Correct 127 ms 17144 KB Ok
9 Correct 63 ms 8696 KB Ok
10 Execution timed out 1095 ms 384 KB Time limit exceeded
11 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 160 ms 17184 KB Ok
2 Correct 308 ms 34156 KB Ok
3 Correct 336 ms 34168 KB Ok
4 Correct 14 ms 1920 KB Ok
5 Correct 1 ms 384 KB Ok
6 Correct 30 ms 3456 KB Ok
7 Correct 295 ms 34296 KB Ok
8 Execution timed out 1089 ms 384 KB Time limit exceeded
9 Halted 0 ms 0 KB -