Submission #11290765


Source Code Expand

Copy
void main() {
	auto ip = readAs!(int[]), K = ip[0], N = ip[1];
	auto A = readAs!(int[]);
	int[] arr;
	foreach(i; 0..N-1) arr ~= A[i+1] - A[i];
	arr ~= (K - A[$-1]) + (A[0]);
	debug arr.writeln;
	(K - arr.reduce!max).writeln;
}

// ===================================

import std.stdio;
import std.string;
import std.functional;
import std.algorithm;
import std.range;
import std.traits;
import std.math;
import std.container;
import std.bigint;
import std.numeric;
import std.conv;
import std.typecons;
import std.uni;
import std.ascii;
import std.bitmanip;
import core.bitop;

T readAs(T)() if (isBasicType!T) {
	return readln.chomp.to!T;
}
T readAs(T)() if (isArray!T) {
	return readln.split.to!T;
}

T[][] readMatrix(T)(uint height, uint width) if (!isSomeChar!T) {
	auto res = new T[][](height, width);
	foreach(i; 0..height) {
		res[i] = readAs!(T[]);
	}
	return res;
}

T[][] readMatrix(T)(uint height, uint width) if (isSomeChar!T) {
	auto res = new T[][](height, width);
	foreach(i; 0..height) {
		auto s = rs;
		foreach(j; 0..width) res[i][j] = s[j].to!T;
	}
	return res;
}

int ri() {
	return readAs!int;
}

double rd() {
	return readAs!double;
}

string rs() {
	return readln.chomp;
}

Submission Info

Submission Time
Task C - Traveling Salesman around Lake
User private_yusuke
Language D (DMD64 v2.070.1)
Score 300
Code Size 1258 Byte
Status AC
Exec Time 46 ms
Memory 11448 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 300 / 300
Status
AC × 2
AC × 23
Set Name Test Cases
Sample sample_01, sample_02
All hand_01, random_01, random_02, random_03, random_04, random_05, random_06, random_07, random_08, random_09, random_10, random_11, random_12, random_13, random_14, random_15, random_16, random_17, random_18, random_19, random_20, sample_01, sample_02
Case Name Status Exec Time Memory
hand_01 AC 45 ms 11320 KB
random_01 AC 31 ms 5096 KB
random_02 AC 45 ms 10324 KB
random_03 AC 45 ms 10056 KB
random_04 AC 10 ms 1636 KB
random_05 AC 44 ms 11220 KB
random_06 AC 45 ms 10432 KB
random_07 AC 44 ms 10104 KB
random_08 AC 45 ms 11092 KB
random_09 AC 45 ms 10060 KB
random_10 AC 22 ms 3940 KB
random_11 AC 46 ms 11324 KB
random_12 AC 45 ms 11068 KB
random_13 AC 45 ms 11448 KB
random_14 AC 45 ms 10168 KB
random_15 AC 46 ms 11192 KB
random_16 AC 45 ms 10808 KB
random_17 AC 45 ms 11320 KB
random_18 AC 46 ms 10552 KB
random_19 AC 45 ms 10296 KB
random_20 AC 45 ms 10296 KB
sample_01 AC 1 ms 256 KB
sample_02 AC 1 ms 256 KB