結果
問題 | No.2154 あさかつの参加人数 |
ユーザー | 👑 hos.lyric |
提出日時 | 2022-12-09 21:56:40 |
言語 | D (dmd 2.107.1) |
結果 |
AC
|
実行時間 | 449 ms / 2,000 ms |
コード長 | 1,744 bytes |
コンパイル時間 | 3,397 ms |
コンパイル使用メモリ | 106,860 KB |
実行使用メモリ | 17,776 KB |
最終ジャッジ日時 | 2023-09-04 19:20:26 |
合計ジャッジ時間 | 20,000 ms |
ジャッジサーバーID (参考情報) |
judge12 / judge15 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 449 ms
16,800 KB |
testcase_01 | AC | 448 ms
17,776 KB |
testcase_02 | AC | 448 ms
16,976 KB |
testcase_03 | AC | 447 ms
17,248 KB |
testcase_04 | AC | 448 ms
17,452 KB |
testcase_05 | AC | 208 ms
6,384 KB |
testcase_06 | AC | 343 ms
11,892 KB |
testcase_07 | AC | 228 ms
6,640 KB |
testcase_08 | AC | 222 ms
6,652 KB |
testcase_09 | AC | 86 ms
5,848 KB |
testcase_10 | AC | 206 ms
6,464 KB |
testcase_11 | AC | 386 ms
9,788 KB |
testcase_12 | AC | 299 ms
7,444 KB |
testcase_13 | AC | 177 ms
7,460 KB |
testcase_14 | AC | 327 ms
8,004 KB |
testcase_15 | AC | 209 ms
6,380 KB |
testcase_16 | AC | 316 ms
9,740 KB |
testcase_17 | AC | 357 ms
11,940 KB |
testcase_18 | AC | 380 ms
10,068 KB |
testcase_19 | AC | 30 ms
5,596 KB |
testcase_20 | AC | 307 ms
7,696 KB |
testcase_21 | AC | 72 ms
5,996 KB |
testcase_22 | AC | 142 ms
6,676 KB |
testcase_23 | AC | 354 ms
8,236 KB |
testcase_24 | AC | 408 ms
11,676 KB |
ソースコード
import std.conv, std.functional, std.range, std.stdio, std.string; import std.algorithm, std.array, std.bigint, std.bitmanip, std.complex, std.container, std.math, std.mathspecial, std.numeric, std.regex, std.typecons; import core.bitop; class EOFException : Throwable { this() { super("EOF"); } } string[] tokens; string readToken() { for (; tokens.empty; ) { if (stdin.eof) { throw new EOFException; } tokens = readln.split; } auto token = tokens.front; tokens.popFront; return token; } int readInt() { return readToken.to!int; } long readLong() { return readToken.to!long; } real readReal() { return readToken.to!real; } bool chmin(T)(ref T t, in T f) { if (t > f) { t = f; return true; } else { return false; } } bool chmax(T)(ref T t, in T f) { if (t < f) { t = f; return true; } else { return false; } } int binarySearch(alias pred, T)(in T[] as) { int lo = -1, hi = cast(int)(as.length); for (; lo + 1 < hi; ) { const mid = (lo + hi) >> 1; (unaryFun!pred(as[mid]) ? hi : lo) = mid; } return hi; } int lowerBound(T)(in T[] as, T val) { return as.binarySearch!(a => (a >= val)); } int upperBound(T)(in T[] as, T val) { return as.binarySearch!(a => (a > val)); } void main() { try { for (; ; ) { const N = readInt; const M = readInt; auto L = new int[M]; auto R = new int[M]; foreach (i; 0 .. M) { R[i] = readInt; L[i] = readInt - 1; } auto fs = new int[N + 1]; foreach (i; 0 .. M) { ++fs[L[i]]; --fs[R[i]]; } foreach (x; 0 .. N) { fs[x + 1] += fs[x]; } foreach_reverse (x; 0 .. N) { writeln(fs[x]); } debug { writeln("========"); } } } catch (EOFException e) { } }