結果

問題 No.2071 Shift and OR
ユーザー junm0rijunm0ri
提出日時 2022-09-17 12:42:16
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 54 ms / 2,000 ms
コード長 3,475 bytes
コンパイル時間 5,740 ms
コンパイル使用メモリ 249,508 KB
実行使用メモリ 16,216 KB
最終ジャッジ日時 2023-08-23 17:40:11
合計ジャッジ時間 7,871 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 6 ms
6,244 KB
testcase_01 AC 9 ms
6,948 KB
testcase_02 AC 13 ms
8,672 KB
testcase_03 AC 22 ms
10,172 KB
testcase_04 AC 17 ms
9,472 KB
testcase_05 AC 31 ms
12,576 KB
testcase_06 AC 18 ms
9,384 KB
testcase_07 AC 14 ms
8,540 KB
testcase_08 AC 16 ms
9,492 KB
testcase_09 AC 17 ms
9,412 KB
testcase_10 AC 17 ms
9,324 KB
testcase_11 AC 28 ms
13,292 KB
testcase_12 AC 29 ms
13,348 KB
testcase_13 AC 30 ms
12,668 KB
testcase_14 AC 5 ms
5,516 KB
testcase_15 AC 24 ms
11,056 KB
testcase_16 AC 24 ms
10,920 KB
testcase_17 AC 34 ms
13,344 KB
testcase_18 AC 8 ms
7,028 KB
testcase_19 AC 39 ms
14,120 KB
testcase_20 AC 37 ms
14,172 KB
testcase_21 AC 47 ms
16,216 KB
testcase_22 AC 38 ms
14,664 KB
testcase_23 AC 47 ms
4,784 KB
testcase_24 AC 6 ms
4,380 KB
testcase_25 AC 22 ms
4,376 KB
testcase_26 AC 28 ms
4,376 KB
testcase_27 AC 2 ms
4,376 KB
testcase_28 AC 54 ms
4,572 KB
testcase_29 AC 53 ms
4,660 KB
testcase_30 AC 20 ms
10,200 KB
testcase_31 AC 16 ms
10,280 KB
testcase_32 AC 17 ms
10,380 KB
testcase_33 AC 17 ms
10,204 KB
testcase_34 AC 17 ms
10,376 KB
testcase_35 AC 18 ms
10,276 KB
testcase_36 AC 19 ms
10,268 KB
testcase_37 AC 18 ms
10,308 KB
testcase_38 AC 16 ms
10,180 KB
testcase_39 AC 17 ms
10,256 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

//らせん階段
// カブト虫
// 廃墟の街
// イチジクのタルト
// カブト虫
//ドロローサへの道
// カブト虫
// 特異点
// ジョット
// エンジェル
// 紫陽花
// カブト虫
// 特異点
// 秘密の皇帝


#include <bits/stdc++.h>
#include<cmath>
#include <ext/pb_ds/assoc_container.hpp>
#include<atcoder/all>
// tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> S;
// #include<boost/multiprecision/cpp_int.hpp>
// using namespace boost::multiprecision;
using namespace std;
using namespace __gnu_pbds;
using namespace atcoder;
// ↓変数の値はA.val()で取得する
using mint9 = modint998244353;
using mint7 = modint1000000007;
#define ll long long
#define ld long double
#define pi pair<int,int>
#define PQ priority_queue<int>
#define PQG priority_queue<int, vector<int>, greater<int>>
#define MV(V,N) vector<int> (V)(N); for (int i=0;i<(N);i++) cin >>V[i];
#define vi vector<int> 
#define vld vector<long double> 
#define vs vector<string> 
#define vp vector<pi>
#define vvi(V,H,W) vector<vector<int>> (V)((H),vector<int>(W));
#define vvl(V,H,W) vector<vector<ll>> (V)((H),vector<ll>(W));
#define vvld(V,H,W) vector<vector<long double>> (V)((H),vector<long double>(W));
#define vvs(V,H,W) vector<vector<string>> (V)((H),vector<string>(W));
#define vvc(V,H,W) vector<vector<char>> (V)((H),vector<char>(W));
#define checkV(V) for (auto x:V) cout<<x<<" ";cout<<endl;
#define irep(n) for (int i=0; i < (n); ++i)
#define irepf1(n) for (int i=1; i <= (n); ++i)
#define jrep(n) for (int j=0; j < (n); ++j)
#define jrepf1(n) for (int j=1; j <= (n); ++j)
#define krep(n) for (int k=0; k < (n); ++k)
#define krepf1(n) for (int k=1; k <= (n); ++k)
#define rep(i,s,e) for (int (i)=(s); (i)<(e);(i)++)
#define per(i,s,e) for (int (i)=(s); (i)>=(e);(i)--)
#define INF 1000000000000000000
#define PI 3.14159265358979323846264338327950288
#define Banpei 1000000000 //問題毎に設定
#define Max_V 100000
#define mod7 1000000007
#define mod9 998244353
#define eps 0.00000001
#define ALL(V,A) ((V).begin(),(V).end(),(A))
#define Find(V,X) find(V.begin(),V.end(),X)
#define Lbound(V,X) *lower_bound((V).begin(),(V).end(),(X))
#define LboundP(V,X) lower_bound((V).begin(),(V).end(),(X))-(V).begin();
#define Ubound(V,X) *upper_bound((V).begin(),(V).end(),(X))
#define UboundP(V,X) upper_bound((V).begin(),(V).end(),(X))-(V).begin();
#define Sort(V) sort((V).begin(),(V).end())
#define SortPairBySecond(V)  sort((V).begin(), (V).end(), [](auto a, auto b) { return a.second < b.second; });
#define Reverse(V) reverse((V).begin(),(V).end())
#define Greater(V) sort((V).begin(),(V).end(),greater<int>())
#define cmin(ans,A) (ans)=min((ans),(A))
#define cmax(ans,A) (ans)=max((ans),(A))
#define AUTO(x,V) for (auto (x):(V))
#define int long long
//fixed << setprecision(10) <<

using Graph = vector<vector<int>>;
Graph makeGraph(int N, int V) {
  Graph G(N);
  irep (V) {
    int A,B;
    cin >>A>>B;
    A--;B--;
    G[A].push_back(B);
    G[B].push_back(A);
  }
  return G;
}

signed main() {
  int N;
  cin >>N;
  MV(V,N);
  if (N>=16) {
    cout<<pow(2,16)-1<<endl;
    return 0;
  }

  vvi(dp,N+1,100000);
  dp[0][0]=1;
  irep(N) {
    int stock=V[i];
    jrep(16) {
      stock=(stock%2)*pow(2,15)+stock/2;
      // cout<<stock<<" ";
      krep(100000) {
        if (dp[i][k]) dp[i+1][stock|k]=1;
      }
    }
    // cout<<endl;
  }

  per(i,99999,0) if (dp[N][i]) {
    cout<<i<<endl;
    return 0;
  }

  
}
0