Submission #214347


Source Code Expand

import java.util.Arrays;
import java.util.Scanner;

public class Main {
	MyScanner sc = new MyScanner();
	Scanner sc2 = new Scanner(System.in);
	final int MOD = 1000000007;
	int[] dx = { 1, 0, 0, -1 };
	int[] dy = { 0, 1, -1, 0 };

	void run() {
		int N = sc.nextInt();
		int M = sc.nextInt();
		int D = sc.nextInt();
		int[] A = new int[M];
		for (int i = 0; i < M; i++) {
			A[i] = sc.nextInt();
		}
		int[][] ami = new int[M][N * 2 - 1];
		for (int i = 0; i < N * 2 - 1; i++) {
			if (i % 2 == 0) {
				for (int j = 0; j < M; j++) {
					ami[j][i] = 1;
				}
			}
		}
		for (int i = 0; i < M; i++) {
			int d = A[i] * 2 - 1;
			ami[i][d] = 1;
		}
		for (int I = 0; I < N; I++) {
			int sx = I * 2;
			for (int i = 0; i < M; i++) {
				if (sx - 1 >= 0 && ami[i][sx - 1] == 1) {
					sx -= 2;
				} else if (sx + 1 < N * 2 - 1 && ami[i][sx + 1] == 1) {
					sx += 2;
				}
			}
			System.out.println(sx / 2 + 1);
		}
	}

	public static void main(String[] args) {
		new Main().run();
	}

	void debug(Object... o) {
		System.out.println(Arrays.deepToString(o));
	}

	void debug2(int[][] array) {
		for (int i = 0; i < array.length; i++) {
			for (int j = 0; j < array[i].length; j++) {
				System.out.print(array[i][j]);
			}
			System.out.println();
		}
	}

	class MyScanner {
		int nextInt() {
			try {
				int c = System.in.read();
				while (c != '-' && (c < '0' || '9' < c))
					c = System.in.read();
				if (c == '-')
					return -nextInt();
				int res = 0;
				do {
					res *= 10;
					res += c - '0';
					c = System.in.read();
				} while ('0' <= c && c <= '9');
				return res;
			} catch (Exception e) {
				return -1;
			}
		}

		double nextDouble() {
			return Double.parseDouble(next());
		}

		String next() {
			try {
				StringBuilder res = new StringBuilder("");
				int c = System.in.read();
				while (Character.isWhitespace(c))
					c = System.in.read();
				do {
					res.append((char) c);
				} while (!Character.isWhitespace(c = System.in.read()));
				return res.toString();
			} catch (Exception e) {
				return null;
			}
		}
	}
}

Submission Info

Submission Time
Task D - 阿弥陀
User suigingin
Language Java (OpenJDK 1.7.0)
Score 0
Code Size 2160 Byte
Status WA
Exec Time 2770 ms
Memory 281072 KB

Judge Result

Set Name Subtask1 Subtask2 Subtask3 Subtask4
Score / Max Score 0 / 10 0 / 20 0 / 20 0 / 50
Status
AC × 4
MLE × 5
AC × 4
WA × 11
MLE × 3
AC × 9
WA × 9
AC × 1
WA × 2
MLE × 26
Set Name Test Cases
Subtask1 sample_1.txt, 01_i.txt, 01_random01.txt, 01_random02.txt, 01_random03.txt, 01_random04.txt, 01_random05.txt, 01_random06.txt, 01_random07.txt
Subtask2 sample_1.txt, sample_2.txt, sample_3.txt, 02_i.txt, 02_p.txt, 02_random01.txt, 02_random02.txt, 02_random03.txt, 02_random04.txt, 02_random05.txt, 02_random06.txt, 02_random07.txt, 02_random08.txt, 02_rp01.txt, 02_rp02.txt, 02_rp03.txt, 02_rp04.txt, 02_rp05.txt
Subtask3 sample_1.txt, sample_2.txt, 03_i.txt, 03_random01.txt, 03_random02.txt, 03_random03.txt, 03_random04.txt, 03_random05.txt, 03_random06.txt, 03_random07.txt, 03_random08.txt, 03_random09.txt, 03_random10.txt, 03_random11.txt, 03_random12.txt, 03_random13.txt, 03_random14.txt, 03_random15.txt
Subtask4 sample_1.txt, sample_2.txt, sample_3.txt, 04_i.txt, 04_p1.txt, 04_p2.txt, 04_random01.txt, 04_random02.txt, 04_random03.txt, 04_random04.txt, 04_random05.txt, 04_random06.txt, 04_random07.txt, 04_random08.txt, 04_random09.txt, 04_random10.txt, 04_random11.txt, 04_random12.txt, 04_random13.txt, 04_rp01.txt, 04_rp02.txt, 04_rp03.txt, 04_rp04.txt, 04_rp05.txt, 04_rp06.txt, 04_rp07.txt, 04_rp08.txt, 04_rp09.txt, 04_rp10.txt
Case Name Status Exec Time Memory
01_i.txt MLE 1149 ms 277344 KB
01_random01.txt AC 444 ms 23080 KB
01_random02.txt AC 439 ms 23084 KB
01_random03.txt AC 437 ms 23088 KB
01_random04.txt MLE 2770 ms 264788 KB
01_random05.txt MLE 1044 ms 274816 KB
01_random06.txt MLE 1118 ms 274412 KB
01_random07.txt MLE 1131 ms 277488 KB
02_i.txt AC 635 ms 45976 KB
02_p.txt WA 568 ms 37828 KB
02_random01.txt AC 441 ms 23092 KB
02_random02.txt WA 440 ms 23220 KB
02_random03.txt WA 699 ms 53364 KB
02_random04.txt AC 480 ms 23224 KB
02_random05.txt WA 2085 ms 182684 KB
02_random06.txt MLE 1250 ms 281072 KB
02_random07.txt MLE 1248 ms 272492 KB
02_random08.txt MLE 1235 ms 272608 KB
02_rp01.txt WA 598 ms 37848 KB
02_rp02.txt WA 591 ms 37836 KB
02_rp03.txt WA 572 ms 37720 KB
02_rp04.txt WA 573 ms 37824 KB
02_rp05.txt WA 571 ms 37848 KB
03_i.txt AC 440 ms 23088 KB
03_random01.txt AC 454 ms 24984 KB
03_random02.txt AC 538 ms 38496 KB
03_random03.txt AC 507 ms 31416 KB
03_random04.txt AC 531 ms 39160 KB
03_random05.txt AC 473 ms 26436 KB
03_random06.txt WA 672 ms 26504 KB
03_random07.txt AC 498 ms 27644 KB
03_random08.txt WA 446 ms 23604 KB
03_random09.txt WA 503 ms 29876 KB
03_random10.txt WA 533 ms 39196 KB
03_random11.txt WA 599 ms 46900 KB
03_random12.txt WA 607 ms 47176 KB
03_random13.txt AC 562 ms 38864 KB
03_random14.txt WA 550 ms 38952 KB
03_random15.txt WA 488 ms 28548 KB
04_i.txt MLE 1125 ms 277360 KB
04_p1.txt MLE 1108 ms 276332 KB
04_p2.txt MLE 1108 ms 277868 KB
04_random01.txt MLE 1121 ms 277232 KB
04_random02.txt MLE 1081 ms 279024 KB
04_random03.txt MLE 1119 ms 280304 KB
04_random04.txt MLE 1117 ms 272496 KB
04_random05.txt MLE 1096 ms 280172 KB
04_random06.txt MLE 1090 ms 278892 KB
04_random07.txt MLE 1113 ms 279836 KB
04_random08.txt MLE 1131 ms 279148 KB
04_random09.txt MLE 1116 ms 279920 KB
04_random10.txt MLE 1036 ms 277104 KB
04_random11.txt MLE 1131 ms 277452 KB
04_random12.txt MLE 1122 ms 276980 KB
04_random13.txt MLE 1123 ms 277484 KB
04_rp01.txt MLE 1107 ms 277360 KB
04_rp02.txt MLE 1090 ms 277484 KB
04_rp03.txt MLE 1097 ms 277488 KB
04_rp04.txt MLE 1096 ms 277488 KB
04_rp05.txt MLE 1093 ms 277480 KB
04_rp06.txt MLE 1099 ms 277360 KB
04_rp07.txt MLE 1100 ms 277356 KB
04_rp08.txt MLE 1088 ms 277484 KB
04_rp09.txt MLE 1098 ms 277364 KB
04_rp10.txt MLE 1109 ms 277484 KB
sample_1.txt AC 439 ms 23216 KB
sample_2.txt WA 439 ms 23092 KB
sample_3.txt WA 437 ms 23088 KB