結果
問題 | No.2091 Shio Ramen (Easy) |
ユーザー | ygd. |
提出日時 | 2022-10-20 21:38:42 |
言語 | C++17 (gcc 12.3.0 + boost 1.83.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 1,405 bytes |
コンパイル時間 | 12,728 ms |
コンパイル使用メモリ | 516,320 KB |
実行使用メモリ | 4,332 KB |
最終ジャッジ日時 | 2023-09-12 14:21:56 |
合計ジャッジ時間 | 11,128 ms |
ジャッジサーバーID (参考情報) |
judge11 / judge15 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 1 ms
4,332 KB |
testcase_01 | AC | 1 ms
4,332 KB |
testcase_02 | AC | 2 ms
4,332 KB |
testcase_03 | AC | 2 ms
4,328 KB |
testcase_04 | AC | 1 ms
4,328 KB |
testcase_05 | AC | 1 ms
4,328 KB |
testcase_06 | AC | 1 ms
4,332 KB |
testcase_07 | AC | 1 ms
4,328 KB |
testcase_08 | AC | 2 ms
4,328 KB |
testcase_09 | AC | 2 ms
4,328 KB |
testcase_10 | AC | 1 ms
4,332 KB |
testcase_11 | AC | 1 ms
4,332 KB |
testcase_12 | AC | 1 ms
4,332 KB |
testcase_13 | AC | 2 ms
4,328 KB |
testcase_14 | AC | 1 ms
4,328 KB |
ソースコード
#define _GLIBCXX_DEBUG //遅い可能性がある #include <bits/stdc++.h> #include<atcoder/all> #include<boost/multiprecision/cpp_int.hpp> //多倍長 using namespace boost::multiprecision; // 多倍長.型はcpp_int using namespace atcoder; using namespace std; // #pragma GCC target("avx2") #pragma GCC optimize("O3") #pragma GCC optimize("unroll-loops") // #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define ALL(a) (a).begin(),(a).end() //lower_bound(ALL(a),x) using ll = long long; using P = pair<int,int>; using VI = vector<int>; using VVI = vector<vector<int>>; int MOD = 998244353; int INF = 100100100; const vector<int> dx = {1, 0, -1, 0}; const vector<int> dy = {0, 1, 0, -1}; // int depth[110000]; // int mxdepth[110000]; long long modpow(long long a, long long n, long long mod) { long long res = 1; // a = 0の時は1を出力 if (a == 0) return 1; while (n > 0) { if (n & 1) res = res * a % mod; a = a * a % mod; n >>= 1; } return res; } int main() { int n,s,k; cin >> n >> s >> k; VI A(n); rep(i,n) cin >> A[i]; int mn = k+1; int ans = -1; rep(i,n) { // if (abs(A[i] - s) > k) continue; if (abs(A[i] - s) >= mn) continue; mn = abs(A[i] - s); ans = i; } if (ans == -1){ cout << "Unlucky!" << endl; } else { cout << ans+1 << endl; } }