# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
291005 | 2020-09-04T15:23:36 Z | PeppaPig | "The Lyuboyn" code (IZhO19_lyuboyn) | C++14 | 907 ms | 18796 KB |
#include <bits/stdc++.h> using namespace std; int n, k, t, s; mt19937 rng(time(NULL)); void print(int val) { vector<int> vec; for(int i = 0; i < n; i++, val >>= 1) vec.emplace_back(val & 1); reverse(vec.begin(), vec.end()); for(int x : vec) printf("%d", x); printf("\n"); } chrono::steady_clock::time_point start; chrono::steady_clock::time_point get_now() { return chrono::steady_clock::now(); } int elapsed() { return (int)chrono::duration_cast<chrono::milliseconds>(get_now() - start).count(); } int main() { start = get_now(); char input[100]; scanf("%d %d %d %s", &n, &k, &t, input); for(int i = 0; input[i] != '\0'; i++) s = (s << 1) + (input[i] == '1'); vector<int> base; for(int i = 0; i < (1 << n); i++) if(__builtin_popcount(i) == k) base.emplace_back(i); while(!t || elapsed() <= 600) { shuffle(base.begin(), base.end(), rng); vector<int> ans = {s}; for(int j = 0; j < n; j++) for(int i = (int)ans.size() - 1; ~i; i--) ans.emplace_back(ans[i] ^ base[j]); set<int> st(ans.begin(), ans.end()); if((int)st.size() == (1 << n)) { printf("%d\n", (1 << n)); for(int x : ans) print(x); exit(0); } if(!t && elapsed() >= 900) break; } printf("-1\n"); return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 256 KB | Ok |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 256 KB | Ok |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 592 ms | 680 KB | Ok |
2 | Correct | 634 ms | 7540 KB | Ok |
3 | Correct | 907 ms | 4176 KB | Ok |
4 | Correct | 601 ms | 256 KB | Ok |
5 | Correct | 894 ms | 384 KB | Ok |
6 | Correct | 601 ms | 420 KB | Ok |
7 | Correct | 892 ms | 664 KB | Ok |
8 | Correct | 604 ms | 3964 KB | Ok |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 645 ms | 18796 KB | Ok |
2 | Correct | 296 ms | 9328 KB | Ok |
3 | Correct | 2 ms | 384 KB | Ok |
4 | Correct | 0 ms | 256 KB | Ok |
5 | Correct | 1 ms | 384 KB | Ok |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 384 KB | Ok |
2 | Correct | 21 ms | 896 KB | Ok |
3 | Correct | 419 ms | 9568 KB | Ok |
4 | Correct | 142 ms | 4864 KB | Ok |
5 | Correct | 2 ms | 384 KB | Ok |
6 | Correct | 4 ms | 384 KB | Ok |
7 | Correct | 94 ms | 2520 KB | Ok |
8 | Correct | 1 ms | 384 KB | Ok |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 766 ms | 18776 KB | Ok |
2 | Correct | 686 ms | 18796 KB | Ok |
3 | Incorrect | 900 ms | 7824 KB | Output -1 while solution exists |
4 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 645 ms | 18796 KB | Ok |
2 | Correct | 296 ms | 9328 KB | Ok |
3 | Correct | 2 ms | 384 KB | Ok |
4 | Correct | 0 ms | 256 KB | Ok |
5 | Correct | 1 ms | 384 KB | Ok |
6 | Correct | 1 ms | 384 KB | Ok |
7 | Correct | 21 ms | 896 KB | Ok |
8 | Correct | 419 ms | 9568 KB | Ok |
9 | Correct | 142 ms | 4864 KB | Ok |
10 | Correct | 2 ms | 384 KB | Ok |
11 | Correct | 4 ms | 384 KB | Ok |
12 | Correct | 94 ms | 2520 KB | Ok |
13 | Correct | 1 ms | 384 KB | Ok |
14 | Correct | 766 ms | 18776 KB | Ok |
15 | Correct | 686 ms | 18796 KB | Ok |
16 | Incorrect | 900 ms | 7824 KB | Output -1 while solution exists |
17 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 598 ms | 4064 KB | Output -1 while solution exists |
2 | Halted | 0 ms | 0 KB | - |