Submission #35890815
Source Code Expand
#include <bits/stdc++.h>
typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;
using namespace std;
int main() {
int N, x, y;
int Bord = 10000;
cin >> N >> x >> y;
vector<int> A(N),B,C;
for (int i = 0; i < N; i++) {
cin >> A[i];
if (i % 2 == 0)B.push_back(A[i]);
else {
C.push_back(A[i]);
}
}
vector<vector<bool>> X(N+1, vector<bool>(30001));
vector<vector<bool>> Y(N+1, vector<bool>(30001));
X[0][B[0] + Bord] = true;
Y[0][C[0] + Bord] = true;
Y[0][-C[0] + Bord] = true;
for (int i = 1; i < B.size(); i++) {
for (int j = 0; j < 20001; j++) {
if (j - B[i] >= 0) {
if (X[i - 1][j - B[i]])X[i][j] = true;
}
if (X[i - 1][j + B[i]])X[i][j] = true;
}
}
for (int i = 1; i < C.size(); i++) {
for (int j = 0; j < 20001; j++) {
if (j - C[i] >= 0) {
if (Y[i - 1][j - C[i]])Y[i][j] = true;
}
if (Y[i - 1][j + C[i]])Y[i][j] = true;
}
}
if (X[B.size()-1][x + Bord] == true && Y[C.size()-1][y + Bord] == true) {
cout << "Yes" << endl;
}
else {
cout << "No" << endl;
}
return 0;
}
Submission Info
| Submission Time | |
|---|---|
| Task | D - Robot Arms 2 |
| User | amaoto |
| Language | C++ (GCC 9.2.1) |
| Score | 400 |
| Code Size | 1153 Byte |
| Status | AC |
| Exec Time | 63 ms |
| Memory | 11064 KiB |
Compile Error
./Main.cpp: In function ‘int main()’:
./Main.cpp:29:20: warning: comparison of integer expressions of different signedness: ‘int’ and ‘std::vector<int>::size_type’ {aka ‘long unsigned int’} [-Wsign-compare]
29 | for (int i = 1; i < B.size(); i++) {
| ~~^~~~~~~~~~
./Main.cpp:37:20: warning: comparison of integer expressions of different signedness: ‘int’ and ‘std::vector<int>::size_type’ {aka ‘long unsigned int’} [-Wsign-compare]
37 | for (int i = 1; i < C.size(); i++) {
| ~~^~~~~~~~~~
Judge Result
| Set Name | Sample | All | ||||
|---|---|---|---|---|---|---|
| Score / Max Score | 0 / 0 | 400 / 400 | ||||
| Status |
|
|
| Set Name | Test Cases |
|---|---|
| Sample | 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt, 00_sample_03.txt, 00_sample_04.txt |
| All | 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt, 00_sample_03.txt, 00_sample_04.txt, 01_random_00.txt, 01_random_01.txt, 01_random_02.txt, 01_random_03.txt, 01_random_04.txt, 01_random_05.txt, 01_random_06.txt, 01_random_07.txt, 01_random_08.txt, 01_random_09.txt, 02_corner_00.txt, 02_corner_01.txt, 03_handmade_00.txt, 03_handmade_01.txt, 03_handmade_02.txt, 03_handmade_03.txt, 03_handmade_04.txt, 03_handmade_05.txt, 03_handmade_06.txt, 03_handmade_07.txt, 03_handmade_08.txt, 03_handmade_09.txt |
| Case Name | Status | Exec Time | Memory |
|---|---|---|---|
| 00_sample_00.txt | AC | 8 ms | 3620 KiB |
| 00_sample_01.txt | AC | 3 ms | 3524 KiB |
| 00_sample_02.txt | AC | 4 ms | 3516 KiB |
| 00_sample_03.txt | AC | 3 ms | 3620 KiB |
| 00_sample_04.txt | AC | 3 ms | 3676 KiB |
| 01_random_00.txt | AC | 45 ms | 8932 KiB |
| 01_random_01.txt | AC | 59 ms | 10952 KiB |
| 01_random_02.txt | AC | 17 ms | 4700 KiB |
| 01_random_03.txt | AC | 61 ms | 11060 KiB |
| 01_random_04.txt | AC | 56 ms | 10580 KiB |
| 01_random_05.txt | AC | 59 ms | 10936 KiB |
| 01_random_06.txt | AC | 41 ms | 8132 KiB |
| 01_random_07.txt | AC | 63 ms | 10864 KiB |
| 01_random_08.txt | AC | 17 ms | 4992 KiB |
| 01_random_09.txt | AC | 58 ms | 11064 KiB |
| 02_corner_00.txt | AC | 59 ms | 10920 KiB |
| 02_corner_01.txt | AC | 58 ms | 11060 KiB |
| 03_handmade_00.txt | AC | 59 ms | 10920 KiB |
| 03_handmade_01.txt | AC | 60 ms | 10980 KiB |
| 03_handmade_02.txt | AC | 56 ms | 10872 KiB |
| 03_handmade_03.txt | AC | 57 ms | 10948 KiB |
| 03_handmade_04.txt | AC | 58 ms | 10900 KiB |
| 03_handmade_05.txt | AC | 60 ms | 11004 KiB |
| 03_handmade_06.txt | AC | 57 ms | 11028 KiB |
| 03_handmade_07.txt | AC | 61 ms | 11060 KiB |
| 03_handmade_08.txt | AC | 4 ms | 3540 KiB |
| 03_handmade_09.txt | AC | 3 ms | 3596 KiB |