Submission #74271549
Source Code Expand
#include <iostream>
#include <vector>
using namespace std;
int main() {
int N;
cin >> N;
vector<vector<long long>> cost(N + 1, vector<long long>(N + 1));
for (int i = 1; i <= N - 1; ++i) {
for (int j = i + 1; j <= N; ++j) {
cin >> cost[i][j];
}
}
bool found = false;
for (int a = 1; a <= N; ++a) {
for (int b = a + 1; b <= N; ++b) {
for (int c = b + 1; c <= N; ++c) {
if (cost[a][b] + cost[b][c] < cost[a][c]) {
found = true;
goto end_loop;
}
}
}
}
end_loop:
cout << (found ? "Yes" : "No");
return 0;
}
Submission Info
| Submission Time | |
|---|---|
| Task | B - Split Ticketing |
| User | xuhanjin |
| Language | C++23 (GCC 15.2.0) |
| Score | 200 |
| Code Size | 710 Byte |
| Status | AC |
| Exec Time | 2 ms |
| Memory | 3720 KiB |
Judge Result
| Set Name | Sample | All | ||||
|---|---|---|---|---|---|---|
| Score / Max Score | 0 / 0 | 200 / 200 | ||||
| Status |
|
|
| Set Name | Test Cases |
|---|---|
| Sample | 00_sample_01.txt, 00_sample_02.txt |
| All | 00_sample_01.txt, 00_sample_02.txt, 01_01.txt, 01_02.txt, 01_03.txt, 02_01.txt, 02_02.txt, 02_03.txt, 03_01.txt, 03_02.txt, 03_03.txt, 04_01.txt, 04_02.txt, 04_03.txt, 04_04.txt, 04_05.txt, 04_06.txt |
| Case Name | Status | Exec Time | Memory |
|---|---|---|---|
| 00_sample_01.txt | AC | 1 ms | 3504 KiB |
| 00_sample_02.txt | AC | 1 ms | 3564 KiB |
| 01_01.txt | AC | 1 ms | 3496 KiB |
| 01_02.txt | AC | 1 ms | 3528 KiB |
| 01_03.txt | AC | 2 ms | 3596 KiB |
| 02_01.txt | AC | 1 ms | 3592 KiB |
| 02_02.txt | AC | 1 ms | 3624 KiB |
| 02_03.txt | AC | 2 ms | 3624 KiB |
| 03_01.txt | AC | 1 ms | 3572 KiB |
| 03_02.txt | AC | 2 ms | 3632 KiB |
| 03_03.txt | AC | 2 ms | 3720 KiB |
| 04_01.txt | AC | 1 ms | 3560 KiB |
| 04_02.txt | AC | 1 ms | 3568 KiB |
| 04_03.txt | AC | 1 ms | 3704 KiB |
| 04_04.txt | AC | 2 ms | 3632 KiB |
| 04_05.txt | AC | 1 ms | 3468 KiB |
| 04_06.txt | AC | 1 ms | 3484 KiB |