Submission #74292332
Source Code Expand
import java.util.*;
class Main {
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
int n=sc.nextInt();
int[][] cost=new int[n+1][n+1];
for(int i=1;i<cost.length;i++){
for(int j=i+1;j<cost[0].length;j++){
int price=sc.nextInt();
cost[i][j]=price;
}
}
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]){
System.out.println("Yes");
return;
}
}
}
}
System.out.println("No");
}
}
Submission Info
| Submission Time | |
|---|---|
| Task | B - Split Ticketing |
| User | renu_ |
| Language | Java24 (OpenJDK 24.0.2) |
| Score | 200 |
| Code Size | 775 Byte |
| Status | AC |
| Exec Time | 122 ms |
| Memory | 46660 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 | 61 ms | 40920 KiB |
| 00_sample_02.txt | AC | 59 ms | 39996 KiB |
| 01_01.txt | AC | 57 ms | 40180 KiB |
| 01_02.txt | AC | 96 ms | 42708 KiB |
| 01_03.txt | AC | 111 ms | 46656 KiB |
| 02_01.txt | AC | 59 ms | 40896 KiB |
| 02_02.txt | AC | 98 ms | 43120 KiB |
| 02_03.txt | AC | 113 ms | 46528 KiB |
| 03_01.txt | AC | 60 ms | 40672 KiB |
| 03_02.txt | AC | 114 ms | 46488 KiB |
| 03_03.txt | AC | 113 ms | 46264 KiB |
| 04_01.txt | AC | 58 ms | 40892 KiB |
| 04_02.txt | AC | 59 ms | 40732 KiB |
| 04_03.txt | AC | 108 ms | 46268 KiB |
| 04_04.txt | AC | 122 ms | 46660 KiB |
| 04_05.txt | AC | 59 ms | 40968 KiB |
| 04_06.txt | AC | 59 ms | 40652 KiB |