Submission #1381549
Source Code Expand
import java.util.ArrayList; import java.util.Scanner; public class Main { public static void main(String[] args) throws Exception { Scanner sc = new Scanner(System.in); ArrayList<Integer> num = new ArrayList<Integer>(); ArrayList<String> param = new ArrayList<String>(); int system = 0; // 文字の空白区切り 0:ON 1:OFF while (sc.hasNext()) { if (sc.hasNextInt()) { num.add(sc.nextInt()); } else { if (system == 0) param.add(sc.next()); if (system == 1) param.add(sc.nextLine()); } } Method(num, param); } static void Method(ArrayList<Integer> num, ArrayList<String> param) { int[] n = new int[100]; for(int i = 0; i <num.size(); i++){ n[i] = num.get(i); } String[] p = new String[100]; for(int i = 0; i <param.size(); i++){ p[i] = param.get(i); } //////////////////////////////////////////////////////////////////// int point = -1; boolean flag = false; for(int i = 0; i < n[0] - n[1]; i++){ //System.out.println(p[n[0]] + " " + p[i]); point = p[i].indexOf(p[n[0]],point+1); //System.out.println(point); if(point == -1) break; for(int k = 1; k < n[1]; k++){ //System.out.println((p[i + k]) + " " + p[n[0] + k]); if(point != (p[i + k]).indexOf(p[n[0] + k],point)) break; //System.out.println(point); if(k == n[1]-1) flag = true; } } if(flag){ System.out.println("Yes"); } else { System.out.println("No"); } } }
Submission Info
Submission Time | |
---|---|
Task | B - Template Matching |
User | unirita153 |
Language | Java8 (OpenJDK 1.8.0) |
Score | 0 |
Code Size | 1503 Byte |
Status | WA |
Exec Time | 114 ms |
Memory | 21972 KB |
Judge Result
Set Name | Sample | All | ||||||
---|---|---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 0 / 200 | ||||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | sample_01.txt, sample_02.txt |
All | sample_01.txt, sample_02.txt, subtask_1_01.txt, subtask_1_02.txt, subtask_1_03.txt, subtask_1_04.txt, subtask_1_05.txt, subtask_1_06.txt, subtask_1_07.txt, subtask_1_08.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
sample_01.txt | AC | 94 ms | 19796 KB |
sample_02.txt | AC | 96 ms | 17492 KB |
subtask_1_01.txt | WA | 92 ms | 19668 KB |
subtask_1_02.txt | AC | 91 ms | 19796 KB |
subtask_1_03.txt | AC | 105 ms | 20948 KB |
subtask_1_04.txt | AC | 97 ms | 21460 KB |
subtask_1_05.txt | AC | 96 ms | 19924 KB |
subtask_1_06.txt | AC | 114 ms | 19924 KB |
subtask_1_07.txt | AC | 109 ms | 21972 KB |
subtask_1_08.txt | WA | 109 ms | 19924 KB |