結果
問題 | No.433 ICPC国内予選の選抜ルールがこんな感じだったらうれしい |
ユーザー | bal4u |
提出日時 | 2019-08-10 19:13:31 |
言語 | C (gcc 12.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,461 bytes |
コンパイル時間 | 1,137 ms |
コンパイル使用メモリ | 29,468 KB |
実行使用メモリ | 7,776 KB |
最終ジャッジ日時 | 2023-09-26 23:35:11 |
合計ジャッジ時間 | 6,171 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge15 |
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 37 ms
7,168 KB |
testcase_01 | AC | 35 ms
7,200 KB |
testcase_02 | AC | 31 ms
6,840 KB |
testcase_03 | AC | 35 ms
6,768 KB |
testcase_04 | AC | 34 ms
6,848 KB |
testcase_05 | AC | 33 ms
6,980 KB |
testcase_06 | AC | 37 ms
7,776 KB |
testcase_07 | AC | 31 ms
7,172 KB |
testcase_08 | AC | 37 ms
7,588 KB |
testcase_09 | AC | 37 ms
7,484 KB |
testcase_10 | AC | 37 ms
7,064 KB |
testcase_11 | AC | 38 ms
7,124 KB |
testcase_12 | AC | 36 ms
6,832 KB |
testcase_13 | AC | 36 ms
7,036 KB |
testcase_14 | AC | 32 ms
6,792 KB |
testcase_15 | AC | 33 ms
7,104 KB |
testcase_16 | AC | 37 ms
7,100 KB |
testcase_17 | AC | 37 ms
7,156 KB |
testcase_18 | AC | 37 ms
6,996 KB |
testcase_19 | AC | 36 ms
7,092 KB |
testcase_20 | AC | 31 ms
6,736 KB |
testcase_21 | AC | 37 ms
7,072 KB |
testcase_22 | AC | 37 ms
7,128 KB |
testcase_23 | AC | 37 ms
7,012 KB |
testcase_24 | AC | 36 ms
7,152 KB |
testcase_25 | AC | 36 ms
7,140 KB |
testcase_26 | AC | 34 ms
7,040 KB |
testcase_27 | AC | 37 ms
7,092 KB |
testcase_28 | AC | 37 ms
7,128 KB |
testcase_29 | AC | 36 ms
7,092 KB |
testcase_30 | AC | 1 ms
5,764 KB |
testcase_31 | AC | 1 ms
5,676 KB |
testcase_32 | AC | 37 ms
6,832 KB |
testcase_33 | AC | 38 ms
7,100 KB |
testcase_34 | AC | 36 ms
7,516 KB |
testcase_35 | AC | 2 ms
5,808 KB |
testcase_36 | AC | 1 ms
5,692 KB |
testcase_37 | AC | 1 ms
5,820 KB |
testcase_38 | AC | 1 ms
5,804 KB |
testcase_39 | AC | 2 ms
5,812 KB |
testcase_40 | AC | 1 ms
5,700 KB |
testcase_41 | AC | 4 ms
5,812 KB |
testcase_42 | AC | 4 ms
5,860 KB |
testcase_43 | AC | 4 ms
5,844 KB |
testcase_44 | AC | 4 ms
5,816 KB |
testcase_45 | WA | - |
testcase_46 | WA | - |
testcase_47 | AC | 5 ms
5,820 KB |
コンパイルメッセージ
main.c: 関数 ‘in’ 内: main.c:9:14: 警告: 関数 ‘getchar_unlocked’ の暗黙的な宣言です [-Wimplicit-function-declaration] 9 | #define gc() getchar_unlocked() | ^~~~~~~~~~~~~~~~ main.c:17:24: 備考: in expansion of macro ‘gc’ 17 | int n = 0, c = gc(); | ^~ main.c: 関数 ‘out’ 内: main.c:10:15: 警告: 関数 ‘putchar_unlocked’ の暗黙的な宣言です [-Wimplicit-function-declaration] 10 | #define pc(c) putchar_unlocked(c) | ^~~~~~~~~~~~~~~~ main.c:26:17: 備考: in expansion of macro ‘pc’ 26 | if (!n) pc('0'); | ^~
ソースコード
// yukicoder 433 ICPC国内予選の選抜ルールがこんな感じだったらうれしい // 2019.8.10 bal4u #include <stdio.h> #include <stdlib.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) #endif int 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]; if (!n) pc('0'); else { i = 0; while (n) b[i++] = n % 10 + '0', n /= 10; while (i--) pc(b[i]); } pc('\n'); } int N, K; typedef struct { int id, s, p, u; } T; T a[100005]; T b[100005]; int sz; int f[1000005]; int cmpsp(const void *u, const void *v) { int t; if (t = ((T *)v)->s - ((T *)u)->s) return t; return ((T *)u)->p - ((T *)v)->p; } int cmpup(const void *u, const void *v) { int t; if (t = ((T *)u)->s - ((T *)v)->s) return t; return ((T *)u)->p - ((T *)v)->p; } int select(int s, int i) { int j; sz = 0; while (a[i].s == s) { b[sz].s = f[a[i].u]++, b[sz].p = a[i].p, b[sz].id = a[i].id; sz++, i++; } qsort(b, sz, sizeof(T), cmpup); for (j = 0; K && j < sz; j++) out(b[j].id), K--; return i; } int main() { int i; N = in(), K = in(); for (i = 0; i < N; i++) { a[i].id = i, a[i].s = in(), a[i].p = in(), a[i].u = in(); } qsort(a, N, sizeof(T), cmpsp); i = 0; while (K) i = select(a[i].s, i); return 0; }