# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
389565 | 2021-04-14T07:33:02 Z | casperwang | Binary Subsequences (info1cup17_binary) | C++14 | 78 ms | 832 KB |
#include <bits/stdc++.h> #define int long long #define pb emplace_back using namespace std; #define debug(args...) kout("[ " + string(#args) + " ]", args) void kout() { cerr << endl; } template <class T, class ...U> void kout(T a, U ...b) { cerr << a << ' ',kout(b...); } template <class T> void pary(T L, T R) { while (L != R) cerr << *L << " \n"[++L==R]; } const int MAXN = 2000; const int K = 10; const int INF = 1e18; int T, N; vector <string> arr; vector <string> tmp; bool ans[MAXN+1]; string str[MAXN+1]; bool check(const string &a, const string &b) { int j = 0; for (int i = 0; i < a.size(); i++) if (j < b.size() && a[i] == b[j]) j++; return j == b.size(); } void init() { for (int i = 1; i <= K; i++) { for (int j = 0; j < (1<<i); j++) { string now = ""; for (int k = 0; k < i; k++) now += ((j & (1<<k)) ? '1' : '0'); int cnt = 1; for (string s : arr) cnt += check(now, s); if (ans[cnt] == 0) ans[cnt] = 1, str[cnt] = now; tmp.pb(now); } for (string s: tmp) arr.pb(s); tmp.clear(); } } signed main() { ios_base::sync_with_stdio(0), cin.tie(0); init(); cin >> T; while (T--) { cin >> N; cout << -1 << '\n'; cout << (ans[N] ? str[N] : "-1") << '\n'; } return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 62 ms | 460 KB | Expected integer, but "00" found |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 62 ms | 824 KB | Execution killed with signal 11 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 78 ms | 832 KB | Execution killed with signal 11 |
2 | Halted | 0 ms | 0 KB | - |