結果
| 問題 | No.1444 !Andd | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2021-01-22 15:34:03 | 
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                WA
                                 
                             | 
| 実行時間 | - | 
| コード長 | 562 bytes | 
| コンパイル時間 | 2,780 ms | 
| コンパイル使用メモリ | 216,936 KB | 
| 最終ジャッジ日時 | 2025-01-18 03:20:40 | 
| ジャッジサーバーID (参考情報) | judge1 / judge1 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | WA * 3 | 
| other | RE * 15 TLE * 5 | 
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:14:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   14 |         scanf("%d", &n);
      |         ~~~~~^~~~~~~~~~
main.cpp:15:43: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   15 |         for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
      |                                      ~~~~~^~~~~~~~~~~~~
            
            ソースコード
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
using namespace std;
#define PB push_back
constexpr int kN = int(5E3 + 10);
constexpr int kC = 1 << 10;
int a[kN];
vector<int> dp[kN];
int main() {
	int n;
	scanf("%d", &n);
	for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
	dp[0].PB(0);
	for (int i = 1; i <= n; i++) {
		for (int j : dp[i - 1]) dp[i].PB(j + a[i]);
		for (int j : dp[i - 1]) dp[i].PB(j & a[i]);
		sort(dp[i].begin(), dp[i].end());
		dp[i].resize(unique(dp[i].begin(), dp[i].end()) - dp[i].begin());
	}
	printf("%d\n", int(dp[n].size()));
}
            
            
            
        