用户输出
Yes
系统信息
Exited with return code 0
编号 | 题目 | 状态 | 分数 | 总时间 | 内存 | 代码 / 答案文件 | 提交者 | 提交时间 |
---|---|---|---|---|---|---|---|---|
#23842 | #1119. Rhodoks的2-sum问题 | Accepted | 100 | 2462 ms | 2296 K | C++ / 714 B | byshen | 2020-02-20 11:03:29 |
#include <iostream>
#include <string.h>
#include <stdio.h>
#include <algorithm>
#include <math.h>
#include <stdlib.h>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <cstdio>
using namespace std;
int main() {
int c, b;
scanf("%d %d", &c, &b);
int a[c];
for (int i = 0; i < c; i++) std::cin >> a[i];
int ans = 0, i = 0, j = c - 1;
sort(a, a + c);
while ((ans == 0) && (i < j)) {
if (a[i] + a[j] == b) {
ans++;
break;
}
if (a[i] + a[j] < b) {
i = i + 1;
}
if (a[i] + a[j] > b)
j = j - 1;
}
if (ans == 1)
printf("Yes\n");
else {
printf("No\n");
}
return 0;
}
用户输出
Yes
系统信息
Exited with return code 0
100 36
-38 -34 -4 7 -24 47 -16 -3 -4 48 -50 36 -25 16 -50 -13 15 -3 19 -46 2 42 -32 -10 -34 21 21 4
<235 bytes omitted>
用户输出
Yes
系统信息
Exited with return code 0
100 -79
-21 -22 -36 30 -39 -42 -31 40 -8 39 -38 -30 44 -14 19 -47 -2 -13 -19 20 -15 14 -18 -6 -34 0
<251 bytes omitted>
用户输出
Yes
系统信息
Exited with return code 0
100 460
34 -16 23 -2 29 47 -26 32 -32 18 4 -9 9 10 15 -35 -25 -17 25 -18 -6 -18 39 45 24 42 -39 -10
<239 bytes omitted>
用户输出
No
系统信息
Exited with return code 0
100 -300
6 -47 48 14 43 -50 -19 -14 31 -3 47 48 -11 -36 1 -50 -14 -16 -17 -40 36 33 -17 -27 24 -20
<238 bytes omitted>
用户输出
No
系统信息
Exited with return code 0
500000 1999999999
999500001 999500002 999500003 999500004 999500005 999500006 999500007 999500008 9
<4999922 bytes omitted>
用户输出
Yes
系统信息
Exited with return code 0
500000 999998
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
<3388807 bytes omitted>
用户输出
No
系统信息
Exited with return code 0
500000 0
0 -1 -2 -3 -4 -5 -6 -7 -8 -9 -10 -11 -12 -13 -14 -15 -16 -17 -18 -19 -20 -21 -22 -23 -24 -
<3888801 bytes omitted>
用户输出
No
系统信息
Exited with return code 0
500000 -500000
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 3
<3388808 bytes omitted>
用户输出
No
系统信息
Exited with return code 0
500000 -1
0 2 -4 -6 8 -10 -12 -14 16 18 -20 -22 24 26 -28 30 -32 34 -36 38 -40 -42 -44 -46 -48 -50
<3694407 bytes omitted>
用户输出
No
系统信息
Exited with return code 0
500000 5000000
0 -2 -4 -6 8 10 -12 -14 16 18 20 22 -24 26 -28 -30 -32 -34 -36 -38 -40 42 44 -46 -48
<3694240 bytes omitted>
用户输出
No
系统信息
Exited with return code 0
500000 -5000000
0 -2 -4 -6 8 10 -12 -14 16 -18 -20 22 24 26 28 -30 32 34 -36 38 -40 -42 -44 -46 48
<3694288 bytes omitted>
用户输出
No
系统信息
Exited with return code 0
500000 2
0 -2 -4 -6 8 -10 12 -14 -16 18 20 -22 24 -26 28 30 32 34 36 -38 -40 42 -44 -46 -48 50 -52
<3694415 bytes omitted>
用户输出
Yes
系统信息
Exited with return code 0
500000 -19
-16410 4130 30166 17220 51116 -24744 52682 -11292 9916 -55000 -7574 5850 48288 -3800 -13
<3165144 bytes omitted>
用户输出
No
系统信息
Exited with return code 0
500000 -6
9582 33136 -49478 -46772 -764 -56534 -22676 54060 -42864 3938 41430 57152 -22270 47340 17
<3165216 bytes omitted>
用户输出
Yes
系统信息
Exited with return code 0
500000 -10
-17708 -32004 -15340 15840 17154 37312 38094 49730 58902 14984 36202 10732 31500 31514 1
<3165404 bytes omitted>
用户输出
Yes
系统信息
Exited with return code 0
500000 -47
-34606 57252 -18412 56602 -32838 4922 -31720 -46646 62922 -26664 10756 -6418 -62992 2699
<3165228 bytes omitted>
用户输出
No
系统信息
Exited with return code 0
500000 -13
-12836 41494 23974 -27518 40170 -52802 -33946 41654 -16366 -32762 -49994 -50148 21358 -3
<3165277 bytes omitted>
用户输出
No
系统信息
Exited with return code 0
500000 15
-43860 -14772 -34908 -55664 -12276 -52360 -7752 -6892 -38452 -31782 -16604 -38254 -7290 -
<3415187 bytes omitted>
用户输出
Yes
系统信息
Exited with return code 0
500000 40
-38852 -64310 -37250 -44704 -53660 -10886 -51092 -45282 -3050 -11492 -20262 -34476 -64410
<3415069 bytes omitted>
用户输出
Yes
系统信息
Exited with return code 0
500000 11
-19534 -22528 -53384 -9086 -50906 -4710 -61370 -30008 -62516 -37182 -4874 -3654 -30868 -3
<3414993 bytes omitted>
用户输出
Yes
系统信息
Exited with return code 0
500000 57
-54168 -2 -55314 -25306 -35064 -17690 -32672 -5152 -22468 -41292 -49084 -18996 -62682 -42
<3415511 bytes omitted>
用户输出
Yes
系统信息
Exited with return code 0