QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#783735 | #3573. Joint Venture | SGColin# | 0 | 0ms | 3732kb | C++17 | 971b | 2024-11-26 11:35:25 | 2024-11-26 11:35:44 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
#define eb emplace_back
#define pb push_back
#define all(s) (s).begin(), (s).end()
#define rep(i, a, b) for (int i = (a); i <= (b); ++i)
#define per(i, a, b) for (int i = (a); i >= (b); --i)
inline int rd() {
int x = 0;
bool f = false;
char c = getchar();
for (; !isdigit(c); c = getchar()) f |= (c == '-');
for (; isdigit(c); c = getchar()) x = x * 10 + (c ^ 48);
return f ? -x : x;
}
int main() {
int L = rd() * 10'000'000;
int n = rd();
vector<int> num;
rep(i, 1, n) num.eb(rd());
sort(all(num));
int ptr = 0;
per(i, n - 1, 1) {
while (ptr < n && num[ptr] + num[i] < L) ++ptr;
if (ptr >= i) break;
if (num[ptr] + num[i] == L) {
printf("yes %d %d\n", num[ptr], num[i]);
return 0;
}
}
puts("danger");
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Pretests
Final Tests
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3732kb
input:
1 4 9999998 1 2 9999999 1 0 1 1 5 1 1 10000000 1 1 5000000 1 2 9999997 3 1 2 9999998 3 1 3 2 9999997 5000000 1 3 4 9999996 5000000 1 3 5000000 5000000 5000000 1 3 5000000 5000000 2345 1 3 5000000 3455 5000000 1 3 6000000 5000000 5000000 1 4 2000000 3000000 5000000 6000000 1 4 2000000 4000000 5000000...
output:
yes 1 9999999
result:
wrong answer 2nd lines differ - expected: 'danger', found: ''