結果

問題 No.12 限定された素数
ユーザー char134217728char134217728
提出日時 2017-08-24 08:52:43
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 5,208 bytes
コンパイル時間 1,160 ms
コンパイル使用メモリ 144,880 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-08-16 00:42:29
合計ジャッジ時間 2,026 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 1 ms
4,376 KB
testcase_05 AC 1 ms
4,380 KB
testcase_06 AC 1 ms
4,376 KB
testcase_07 AC 2 ms
4,380 KB
testcase_08 AC 2 ms
4,380 KB
testcase_09 AC 1 ms
4,376 KB
testcase_10 AC 2 ms
4,380 KB
testcase_11 AC 1 ms
4,376 KB
testcase_12 AC 1 ms
4,380 KB
testcase_13 AC 1 ms
4,376 KB
testcase_14 AC 1 ms
4,380 KB
testcase_15 AC 1 ms
4,380 KB
testcase_16 AC 1 ms
4,376 KB
testcase_17 AC 1 ms
4,380 KB
testcase_18 AC 2 ms
4,380 KB
testcase_19 AC 1 ms
4,376 KB
testcase_20 AC 2 ms
4,376 KB
testcase_21 AC 2 ms
4,380 KB
testcase_22 AC 1 ms
4,380 KB
testcase_23 AC 2 ms
4,376 KB
testcase_24 AC 1 ms
4,380 KB
testcase_25 AC 1 ms
4,380 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp:63:6: warning: ISO C++ forbids declaration of ‘main’ with no type [-Wreturn-type]
 main(){
      ^

ソースコード

diff #

#include <bits/stdc++.h>
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define FORR(i,a,b) for (int i=(a);i>=(b);i--)
#define pb push_back
#define pcnt __builtin_popcount
#define show(x) cout<<#x<<" = "<<x<<endl;
#define maxs(x,y) x = max(x,y)
#define mins(x,y) x = min(x,y)
#define fi first
#define se second
#define rng(a) a.begin(),a.end()
#define each(it,c) for(__typeof((c).begin()) it=(c).begin();it!=(c).end();it++)
#define sz(x) (int)(x).size()

using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vpii;
typedef set<int> si;
typedef pair<ll,ll> pll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<pll> vpll;
typedef set<ll> sl;
template<typename T>string join(vector<T>&v)
{stringstream s;FOR(i,0,sz(v))s<<' '<<v[i];return s.str().substr(1);}
ll gcd(ll a,ll b){if(a>b)swap(a,b);for(;a>0;b%=a,swap(a,b));return b;}
int modpow(ll a,ll n,int m){if(a==0)return a;ll p=1;for(;n>0;n/=2,a=a*a%m)if(n&1)p=p*a%m;return (int)p;}

const int iinf = 1e9;
const ll linf = 4e18;
const int mod = 1e9+7;
const double eps = 1e-10;

int a[1024] = {
  152,-1,4,28,1,-1,82,94,1,-1,94,100,64,104,148,124,-1,-1,136,86,-1,-1,114,72,58,82,102,124,88,108,134,192,2,-1,76,58,-1,-1,64,82,86,76,112,92,112,100,100,136,
  -1,-1,106,118,-1,-1,82,104,90,100,116,172,94,182,158,176,-1,-1,50,64,-1,-1,82,88,-1,-1,78,98,76,82,138,122,-1,-1,92,100,-1,-1,96,118,78,100,118,140,96,100,124,
  142,-1,-1,68,72,-1,-1,82,132,86,100,118,126,90,84,126,160,-1,-1,90,112,-1,-1,112,100,148,120,174,184,188,112,146,172,4,-1,52,112,42,72,88,108,62,124,120,130,
  106,120,138,190,38,128,148,100,76,66,134,154,108,86,136,138,120,118,172,196,64,52,102,98,58,122,106,148,98,112,158,152,100,124,190,196,82,94,130,166,94,112,
  146,192,118,126,168,222,148,188,194,218,40,68,88,88,66,88,112,152,84,106,136,140,104,126,158,228,72,114,106,124,86,92,148,146,106,126,150,172,136,150,202,248,80,
  54,112,122,84,90,118,120,120,126,220,186,142,120,202,248,106,90,108,138,104,158,184,180,178,204,190,232,208,232,280,338,-1,-1,32,86,-1,-1,94,152,96,90,106,184,120,
  100,130,136,-1,-1,76,100,-1,-1,100,92,78,76,106,148,142,106,136,142,-1,-1,82,94,-1,-1,124,100,68,106,104,120,88,118,118,138,-1,-1,96,120,-1,-1,120,122,112,98,130,
  152,118,116,160,178,-1,-1,62,88,-1,-1,112,96,104,78,118,124,78,106,108,158,-1,-1,106,116,-1,-1,104,110,88,98,146,156,104,140,152,166,-1,-1,86,78,-1,-1,82,100,88,
  80,130,134,106,82,120,166,-1,-1,100,88,-1,-1,106,132,102,126,128,186,136,86,218,210,44,40,84,106,108,82,118,158,118,136,124,208,118,128,214,202,82,98,110,124,100,
  104,134,186,136,150,166,178,148,128,264,216,80,68,90,102,78,96,130,134,110,100,152,182,136,138,228,252,82,110,132,160,126,108,138,190,128,146,198,214,138,158,270,306,
  76,66,148,112,100,112,140,178,132,116,172,190,126,136,220,228,82,94,134,160,96,130,166,212,150,146,218,234,148,194,270,322,62,118,166,124,118,122,158,160,160,124,
  232,272,160,176,220,282,90,120,166,138,116,128,178,198,184,226,260,298,172,186,298,388,-1,-1,58,92,58,58,82,104,-1,-1,108,134,134,112,196,142,58,84,110,126,88,94,126,
  142,98,120,118,154,136,134,238,198,46,108,82,94,80,94,112,122,146,114,124,152,128,112,178,280,70,92,120,150,130,94,132,146,136,158,198,190,172,148,202,278,-1,-1,88,
  100,102,96,118,148,-1,-1,120,168,122,124,166,202,92,112,122,128,104,98,116,178,124,124,154,178,136,168,208,284,78,72,158,112,128,82,112,160,126,138,152,192,146,128,
  178,238,100,122,126,164,98,96,144,196,132,176,240,228,148,148,266,298,68,58,100,154,78,94,118,136,104,134,166,196,102,126,194,288,86,136,118,184,136,136,148,238,124,
  150,156,242,230,176,342,352,68,78,104,112,126,108,146,180,144,192,182,190,148,166,238,358,118,130,166,170,152,120,180,238,170,208,252,298,248,248,396,612,88,76,110,
  158,110,118,150,208,112,166,202,202,166,160,242,364,102,136,156,200,124,130,198,242,160,184,232,280,178,198,354,568,106,94,154,192,104,138,172,218,166,196,324,260,
  192,212,364,508,118,138,196,238,136,150,228,278,208,230,478,488,220,324,516,932,28,78,84,82,92,100,150,190,88,152,152,212,130,124,166,194,80,110,136,116,84,134,148,
  124,108,158,178,182,132,130,236,256,64,52,112,94,102,100,124,150,152,156,168,174,148,136,214,292,94,100,122,180,96,118,148,196,156,166,186,232,172,202,268,350,70,66,
  104,128,84,96,112,192,136,130,118,178,112,142,178,208,88,112,128,130,98,136,118,144,126,144,208,228,148,180,214,312,78,82,166,148,90,94,118,172,130,132,220,292,154,
  158,236,298,86,100,160,142,98,100,142,200,164,148,244,298,160,224,360,412,92,72,118,152,118,102,148,206,106,156,182,262,178,178,240,366,98,132,142,188,130,138,172,
  256,146,194,258,372,190,252,362,604,110,80,136,166,124,136,166,222,160,178,210,296,194,260,330,464,114,126,174,212,142,148,196,304,202,240,318,476,226,284,514,928,
  96,88,166,182,142,138,172,268,154,180,236,332,200,238,406,598,116,136,192,234,128,148,222,298,172,258,416,536,244,276,432,920,98,118,186,200,136,148,234,328,182,218,
  370,470,262,288,466,928,126,154,256,276,132,168,308,418,248,288,492,944,294,478,940,4999999
};
main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n, c = 0;
  cin >> n;
  FOR(i, 0, n){
    int d;
    cin >> d;
    c |= (1<<d);
  }
  cout << a[c] << endl;
}
0