結果
問題 | No.709 優勝可能性 |
ユーザー |
![]() |
提出日時 | 2019-08-04 07:21:33 |
言語 | C (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 36 ms / 3,500 ms |
コード長 | 1,018 bytes |
コンパイル時間 | 116 ms |
コンパイル使用メモリ | 30,720 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-07-07 14:50:07 |
合計ジャッジ時間 | 2,764 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 22 |
コンパイルメッセージ
main.c: In function 'in': main.c:8:14: warning: implicit declaration of function 'getchar_unlocked' [-Wimplicit-function-declaration] 8 | #define gc() getchar_unlocked() | ^~~~~~~~~~~~~~~~ main.c:16:24: note: in expansion of macro 'gc' 16 | int n = 0, c = gc(); | ^~ main.c: In function 'out': main.c:9:15: warning: implicit declaration of function 'putchar_unlocked' [-Wimplicit-function-declaration] 9 | #define pc(c) putchar_unlocked(c) | ^~~~~~~~~~~~~~~~ main.c:26:21: note: in expansion of macro 'pc' 26 | while (i--) pc(b[i]); | ^~
ソースコード
// yukicoder: No.709 優勝可能性// 2019.8.4 bal4u#include <stdio.h>#include <string.h>#if 1#define gc() getchar_unlocked()#define pc(c) putchar_unlocked(c)#else#define gc() getchar()#define pc(c) putchar(c)#endifint in() { // 非負整数の入力int n = 0, c = gc();do n = 10 * n + (c & 0xf); while ((c = gc()) >= '0');return n;}void out(int n) { // 正整数の表示(出力)int i;char b[20];i = 0; while (n) b[i++] = n % 10 + '0', n /= 10;while (i--) pc(b[i]);pc('\n');}int N, M;char f[100005]; int ans;int ma[12], list[12][100005], sz[12];int main(){int i, n, m, r;N = in(), M = in();for (n = 0; n < N; n++) {for (m = 0; m < M; m++) {r = in();if (r > ma[m]) {for (i = 0; i < sz[m]; i++) {if (--f[list[m][i]] == 0) ans--;}ma[m] = r, list[m][0] = n, sz[m] = 1;if (f[n] == 0) ans++;f[n]++;} else if (r == ma[m]) {list[m][sz[m]++] = n;if (f[n] == 0) ans++;f[n]++;}}out(ans);}return 0;}