結果
| 問題 |
No.1032 数数え
|
| ユーザー |
QCFium
|
| 提出日時 | 2020-04-23 20:14:53 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 11 ms / 2,000 ms |
| コード長 | 694 bytes |
| コンパイル時間 | 1,444 ms |
| コンパイル使用メモリ | 165,948 KB |
| 実行使用メモリ | 5,888 KB |
| 最終ジャッジ日時 | 2024-10-13 20:42:01 |
| 合計ジャッジ時間 | 2,369 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 10 |
ソースコード
#include <bits/stdc++.h>
char buf[2000000];
char *p = buf;
int ru() {
int r = 0;
while (*p < '0' || *p > '9') p++;
while (*p >= '0' && *p <= '9') r = r * 10 + *p++ - '0';
return r;
}
void write(int x) { // x >= 0
static char tmp[10];
char *tmpp = tmp;
if (!x) *tmpp++ = '0';
while (x) *tmpp++ = x % 10 + '0', x /= 10;
while (tmpp > tmp) *p++ = *--tmpp;
}
int main() {
fread(buf, sizeof(buf), 1, stdin);
int n = ru();
int m = ru();
int res[m + 1] = { 0 };
for (int i = 0; i < n; i++) {
int x = ru();
if (x <= m) res[x]++;
}
p = buf;
for (int i = 1; i <= m; i++) {
write(i);
*p++ = ' ';
write(res[i]);
*p++ = '\n';
}
fwrite(buf, 1, p - buf, stdout);
return 0;
}
QCFium