結果
問題 | No.1346 Rectangle |
ユーザー |
|
提出日時 | 2021-01-23 15:25:42 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 891 bytes |
コンパイル時間 | 928 ms |
コンパイル使用メモリ | 69,860 KB |
最終ジャッジ日時 | 2025-01-18 07:30:30 |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 15 WA * 2 |
ソースコード
#line 1 "main.cpp"#include <iostream>#include <vector>using namespace std;using lint = long long;void solve() {lint n;cin >> n;if (n >= 6) {cout << "2\n";return;} else if (n >= 5) {cout << "4\n";return;}int m = (1 << n);int ans = 0;for (int b = 0; b < (1 << m); ++b) {bool judge = true;for (int i = 0; i < m; ++i) {if ((~b >> i) & 1) continue;for (int j = 0; j < i; ++j) {if ((~b >> j) & 1) continue;if (__builtin_popcount(i & j) >= 2 ||n - __builtin_popcount(i | j) >= 2) judge = false;}}if (judge) ans = max(ans, __builtin_popcount(b));}cout << ans << "\n";}int main() {cin.tie(nullptr);ios::sync_with_stdio(false);solve();return 0;}