Submission #1353057


Source Code Expand

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

    public static void main(String[] args) throws NumberFormatException, IOException {

        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int intCnt = Integer.parseInt(br.readLine());
        String[] lineArray = br.readLine().split(" ");

        int intResultCnt = 0;
        int intBefore = 0;
        String strFlg = "";
        String firstFlg = "";

        for (int i = 0; i < lineArray.length; i++) {
            int intTmp = Integer.parseInt(lineArray[i]);

            if ("".equals(firstFlg) && intBefore != 0 && intTmp != intBefore) {
                if (intTmp < intBefore) {
                    intResultCnt--;
                    firstFlg = "-";
                } else if (intTmp > intBefore) {
                    firstFlg = "+";
                }
            }

            if (intTmp > intBefore) {
                if (!"+".equals(strFlg)) {
                    intResultCnt++;
                }
                strFlg = "+";
            }
            if (intTmp < intBefore) {
                if ("+".equals(strFlg)) {
                    strFlg = "-";
                } else if ("-".equals(strFlg)) {
                    intResultCnt++;
                    strFlg = "--";
                }
            }
            intBefore = intTmp;
        }

        if ("-".equals(strFlg)) {
            intResultCnt += 1;
        }
        System.out.println(intResultCnt);

    }
}

Submission Info

Submission Time
Task A - Sorted Arrays
User unirita23
Language Java8 (OpenJDK 1.8.0)
Score 0
Code Size 1599 Byte
Status WA
Exec Time 198 ms
Memory 37340 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 300
Status
AC × 3
AC × 11
WA × 6
Set Name Test Cases
Sample sample_01.txt, sample_02.txt, sample_03.txt
All sample_01.txt, sample_02.txt, sample_03.txt, sample_01.txt, sample_02.txt, sample_03.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, subtask_1_09.txt, subtask_1_10.txt, subtask_1_11.txt
Case Name Status Exec Time Memory
sample_01.txt AC 69 ms 19668 KB
sample_02.txt AC 68 ms 19284 KB
sample_03.txt AC 70 ms 18132 KB
subtask_1_01.txt WA 175 ms 33500 KB
subtask_1_02.txt AC 156 ms 29596 KB
subtask_1_03.txt WA 134 ms 27344 KB
subtask_1_04.txt WA 185 ms 35096 KB
subtask_1_05.txt AC 177 ms 34060 KB
subtask_1_06.txt WA 194 ms 35804 KB
subtask_1_07.txt WA 198 ms 37340 KB
subtask_1_08.txt AC 175 ms 35852 KB
subtask_1_09.txt WA 176 ms 36376 KB
subtask_1_10.txt AC 68 ms 18260 KB
subtask_1_11.txt AC 70 ms 19156 KB