結果

問題 No.123 カードシャッフル
ユーザー ki_ki33ki_ki33
提出日時 2015-01-11 23:38:02
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 1,278 bytes
コンパイル時間 2,168 ms
コンパイル使用メモリ 79,272 KB
実行使用メモリ 60,380 KB
最終ジャッジ日時 2023-09-03 23:41:07
合計ジャッジ時間 6,318 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 121 ms
56,136 KB
testcase_01 AC 121 ms
56,348 KB
testcase_02 AC 121 ms
56,072 KB
testcase_03 AC 124 ms
55,824 KB
testcase_04 AC 123 ms
56,124 KB
testcase_05 AC 121 ms
56,148 KB
testcase_06 WA -
testcase_07 AC 118 ms
55,992 KB
testcase_08 AC 118 ms
55,460 KB
testcase_09 AC 120 ms
56,284 KB
testcase_10 AC 434 ms
60,328 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.BufferedInputStream;
import java.io.IOException;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.*;
import java.util.Map.Entry;

public class Main {
	public static final int C =  1000000007;
	//static boolean MAP[][];
	static int N;
	static int M;
	static int MAX = -1;
	//static int tic[][];
	static boolean NUM[];
	//static int max;
	static int A[];
	static int ST[][];
	//static int p[];
	//static ArrayList<HashSet<Integer>> al;
	static TreeMap<Integer, ArrayList<Integer>> hm;
	//static ArrayList<Integer> al;
	//static int a[][];
	//static char[][] ch;
	//static ArrayList<HashMap<Long, Long>> al;
	//static String a[];
	//static String str;
	//static int[] mach = new int[] {6, 2, 5, 5, 4, 5, 6, 3, 7, 6};

	public static void main(String[] args) {
		StringBuilder sb = new StringBuilder();
		BufferedInputStream bs = new BufferedInputStream(System.in);
		Scanner sc = new Scanner(bs);
		
		
		

		
		
		
		N = sc.nextInt();
		
		M = sc.nextInt();
		int a[] = new int[M];
		for (int i=0; i < M; i++) {
			a[i] = sc.nextInt();
		}
		
		int ans = 1;
		
		for (int i=M-1; i >= 0; i--) {
			if (ans == 1) {
				ans = a[i];
			}else if (ans < a[i]) {
				ans--;
			}else {
				
			}
		}
		
		System.out.println(ans);
		


	}
	
	
	

}
0