제출 #343120

#제출 시각아이디문제언어결과실행 시간메모리
343120dxz05"The Lyuboyn" code (IZhO19_lyuboyn)C++14
16 / 100
969 ms262148 KiB
//#pragma GCC optimize("Ofast") #include <bits/stdc++.h> using namespace std; void debug_out() { cerr << endl; } template<typename Head, typename... Tail> void debug_out(Head H, Tail... T) { cerr << "[" << H << "]"; debug_out(T...); } #ifdef dddxxz #define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__) #else #define debug(...) 42 #endif #define SZ(s) ((int)s.size()) clock_t startTime; double getCurrentTime() { return (double) (clock() - startTime) / CLOCKS_PER_SEC; } typedef long long ll; //mt19937 rng(chrono::high_resolution_clock::now().time_since_epoch().count()); const double eps = 0.00001; const int MOD = 1e9 + 7; const int INF = 1000000101; const long long LLINF = 1223372000000000555; const int N = 1e6 + 4e4; const int M = 4500; const int L = 19; vector<int> g[N]; bool flag[N]; vector<int> ans; bool used[N]; void dfs(int v){ used[v] = true; ans.push_back(v); for (int u : g[v]){ if (!used[u]) dfs(u); } } bool check(vector<int> &v, int t){ for (int i = 1; i < v.size(); i++){ if (!flag[v[i - 1] ^ v[i]]) return false; } return (t == 0 || flag[v[0] ^ v.back()]); } void solve(int TC) { int n, k, t, s; cin >> n >> k >> t >> s; vector<int> v; for (int mask = 0; mask < (1 << n); mask++){ if (__builtin_popcount(mask) == k) v.push_back(mask), flag[mask] = true; } for (int x = 0; x < (1 << n); x++){ for (int y : v){ g[x].push_back(x ^ y); //cout << x << ' ' << y << endl; } } dfs(s); if (check(ans, t) && ans.size() == (1 << n)){ cout << ans.size() << endl; for (int x : ans){ for (int i = n - 1; i >= 0; i--){ cout << ((x & (1 << i)) > 0); } cout << endl; } } else cout << -1; } int main() { startTime = clock(); ios_base::sync_with_stdio(false); bool llololcal = false; #ifdef dddxxz freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout); llololcal = true; #endif int TC = 1; //cin >> TC; for (int test = 1; test <= TC; test++) { debug(test); solve(test); } if (llololcal) cerr << endl << "Time: " << getCurrentTime() * 1000 << " ms" << endl; return 0; }

컴파일 시 표준 에러 (stderr) 메시지

lyuboyn.cpp: In function 'bool check(std::vector<int>&, int)':
lyuboyn.cpp:54:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   54 |     for (int i = 1; i < v.size(); i++){
      |                     ~~^~~~~~~~~~
lyuboyn.cpp: In function 'void solve(int)':
lyuboyn.cpp:78:37: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   78 |     if (check(ans, t) && ans.size() == (1 << n)){
      |                          ~~~~~~~~~~~^~~~~~~~~~~
lyuboyn.cpp: In function 'int main()':
lyuboyn.cpp:18:20: warning: statement has no effect [-Wunused-value]
   18 | #define debug(...) 42
      |                    ^~
lyuboyn.cpp:105:9: note: in expansion of macro 'debug'
  105 |         debug(test);
      |         ^~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...