結果
問題 | No.467 隠されていたゲーム |
ユーザー |
![]() |
提出日時 | 2016-12-17 00:20:29 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 2,259 bytes |
コンパイル時間 | 949 ms |
コンパイル使用メモリ | 96,796 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-10-04 16:12:59 |
合計ジャッジ時間 | 1,488 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 24 |
ソースコード
// #includes {{{#include <algorithm>#include <numeric>#include <iostream>#include <string>#include <vector>#include <queue>#include <list>#include <deque>#include <stack>#include <set>#include <map>#include <cstdio>#include <cstdlib>#include <cassert>#include <cstring>#include <cmath>using namespace std;// }}}// pre-written code {{{#define REP(i,n) for(int i=0;i<(int)(n);++i)#define RREP(i,a,b) for(int i=(int)(a);i<(int)(b);++i)#define FOR(i,c) for(__typeof((c).begin()) i=(c).begin();i!=(c).end();++i)#define LET(x,a) __typeof(a) x(a)//#define IFOR(i,it,c) for(__typeof((c).begin())it=(c).begin();it!=(c).end();++it,++i)#define ALL(c) (c).begin(), (c).end()#define MP make_pair#define EXIST(e,s) ((s).find(e)!=(s).end())#define RESET(a) memset((a),0,sizeof(a))#define SET(a) memset((a),-1,sizeof(a))#define PB push_back#define DEC(it,command) __typeof(command) it=command//debug#define dump(x) cerr << #x << " = " << (x) << endl;#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;#define debug2(x) cerr << #x << " = [";REP(__ind,(x).size()){cerr << (x)[__ind] << ", ";}cerr << "] (L" << __LINE__ << ")" << endl;const int INF=0x3f3f3f3f;typedef long long Int;typedef unsigned long long uInt;#ifdef __MINGW32__typedef double rn;#elsetypedef long double rn;#endiftypedef pair<int,int> pii;/*#ifdef MYDEBUG#include"debug.h"#include"print.h"#endif*/// }}}//{{{ gcd and inverseInt gcd(Int a, Int b) {return b != 0 ? gcd(b, a % b) : a;}Int lcm(Int a, Int b) {return a / gcd(a, b) *b;}// a x + b y = gcd(a, b)Int extgcd(Int a, Int b, Int &x, Int &y) {Int g = a; x = 1; y = 0;if (b != 0) g = extgcd(b, a % b, y, x), y -= (a / b) * x;return g;}Int invMod(Int a, Int m) {Int x, y;if (extgcd(a, m, x, y) == 1) return (x + m) % m;else return 0; // unsolvable}//}}}int n,x,y;int d[20];set<int> ds;int main(){cin>>n;REP(i,n)cin>>d[i],ds.insert(d[i]);cin>>x>>y;sort(d,d+n);x = abs(x);y = abs(y);int m = max(x,y);// cerr<<m<<" "<<d[n-1]<<endl;if(x==0 and y==0){cout<<0<<endl;}else if(m<d[n-1] and ds.find(m)==ds.end()){cout<<2<<endl;}else{cout<<(m+d[n-1]-1)/d[n-1]<<endl;}}