結果
問題 | No.602 隠されていたゲーム2 |
ユーザー | ryoissy |
提出日時 | 2017-12-02 00:09:46 |
言語 | C++11 (gcc 11.4.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 836 bytes |
コンパイル時間 | 1,504 ms |
コンパイル使用メモリ | 164,428 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-05-05 21:33:48 |
合計ジャッジ時間 | 2,515 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 1 ms
5,248 KB |
testcase_01 | AC | 2 ms
5,376 KB |
testcase_02 | AC | 2 ms
5,376 KB |
testcase_03 | AC | 1 ms
5,376 KB |
testcase_04 | AC | 2 ms
5,376 KB |
testcase_05 | AC | 1 ms
5,376 KB |
testcase_06 | AC | 1 ms
5,376 KB |
testcase_07 | AC | 2 ms
5,376 KB |
testcase_08 | WA | - |
testcase_09 | WA | - |
testcase_10 | AC | 1 ms
5,376 KB |
testcase_11 | WA | - |
testcase_12 | WA | - |
testcase_13 | WA | - |
testcase_14 | WA | - |
testcase_15 | AC | 1 ms
5,376 KB |
testcase_16 | AC | 6 ms
5,376 KB |
testcase_17 | AC | 9 ms
5,376 KB |
testcase_18 | AC | 24 ms
5,376 KB |
testcase_19 | AC | 28 ms
5,376 KB |
testcase_20 | AC | 31 ms
5,376 KB |
testcase_21 | AC | 18 ms
5,376 KB |
testcase_22 | WA | - |
testcase_23 | AC | 16 ms
5,376 KB |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:13:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 13 | scanf("%d",&n); | ~~~~~^~~~~~~~~ main.cpp:15:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 15 | scanf("%d",&d[i]); | ~~~~~^~~~~~~~~~~~ main.cpp:18:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 18 | scanf("%d%d",&x,&y); | ~~~~~^~~~~~~~~~~~~~
ソースコード
#include <bits/stdc++.h> #define MOD 1000000007LL using namespace std; typedef long long ll; typedef pair<int,int> P; int n; int d[100001]; int x,y; vector<int> vi[2]; int main(void){ scanf("%d",&n); for(int i=0;i<n;i++){ scanf("%d",&d[i]); vi[d[i]%2].push_back(d[i]); } scanf("%d%d",&x,&y); if(x==0 && y==0){ printf("0\n"); return 0; } sort(d,d+n); sort(vi[0].begin(),vi[0].end()); sort(vi[1].begin(),vi[1].end()); for(int i=0;i<n;i++){ if(d[i]==(abs(x)+abs(y))){ printf("1\n"); return 0; } } for(int i=0;i<n;i++){ int rest=abs(x)+abs(y)-d[i]; rest=abs(rest); if(vi[rest%2].size()==0)continue; int vo=lower_bound(vi[rest%2].begin(),vi[rest%2].end(),rest)-vi[rest%2].begin(); if(vo!=vi[rest%2].size() && vi[rest%2][vo]==rest){ printf("2\n"); return 0; } } printf("-1\n"); return 0; }