結果
| 問題 |
No.602 隠されていたゲーム2
|
| コンテスト | |
| ユーザー |
gotutiyan
|
| 提出日時 | 2017-12-02 00:23:50 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,011 bytes |
| コンパイル時間 | 1,088 ms |
| コンパイル使用メモリ | 98,420 KB |
| 実行使用メモリ | 13,636 KB |
| 最終ジャッジ日時 | 2024-11-28 01:32:50 |
| 合計ジャッジ時間 | 19,883 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 7 WA * 9 TLE * 5 |
ソースコード
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <fstream>
#include <set>
#include <utility>
#include <algorithm>
#include <queue>
#include <stack>
#include <deque>
#include <numeric>
#include <sstream>
#include <list>
#include <map>
#include <stdlib.h>
#include <time.h>
#define rep(i,p,n) for(int i=(int)p;i<(int)n;i++)
#define repp(i,p,n) for(int i=(int)p;i>=(int)n;i--)
#define Sort(x) sort(x.begin(),x.end());
#define ll long long
#define INF 2000000000
using namespace std;
int main() {
int n;
cin >> n;
vector<ll> v(n);
rep(i, 0, n)cin >> v[i];
Sort(v);
ll x, y;
cin >> x >> y;
if (x == 0 && y == 0) {
cout << 0 << endl;
return 0;
}
else {
ll dis = abs(x) + abs(y);
rep(i, 0, n) {
if (dis == v[i]) {
cout << 1 << endl;
return 0;
}
}
rep(i, 0, n) {
rep(j, 0, n) {
if (dis == v[i] + v[j]) {
cout << 2 << endl;
return 0;
}
}
}
cout << -1 << endl;
}
return 0;
}
gotutiyan