結果
問題 | No.606 カラフルタイル |
ユーザー | 👑 testestest |
提出日時 | 2017-12-06 00:23:00 |
言語 | C (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 35 ms / 2,000 ms |
コード長 | 599 bytes |
コンパイル時間 | 233 ms |
コンパイル使用メモリ | 29,824 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-11-28 18:52:38 |
合計ジャッジ時間 | 1,694 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 25 |
コンパイルメッセージ
main.c:2:1: warning: data definition has no type or storage class 2 | num[100010]; | ^~~ main.c:2:1: warning: type defaults to 'int' in declaration of 'num' [-Wimplicit-int] main.c:3:1: warning: data definition has no type or storage class 3 | color[100010]; | ^~~~~ main.c:3:1: warning: type defaults to 'int' in declaration of 'color' [-Wimplicit-int] main.c:4:1: warning: data definition has no type or storage class 4 | r[100010],c[100010]; | ^ main.c:4:1: warning: type defaults to 'int' in declaration of 'r' [-Wimplicit-int] main.c:4:11: warning: type defaults to 'int' in declaration of 'c' [-Wimplicit-int] 4 | r[100010],c[100010]; | ^ main.c:5:1: warning: data definition has no type or storage class 5 | rcnt,ccnt; | ^~~~ main.c:5:1: warning: type defaults to 'int' in declaration of 'rcnt' [-Wimplicit-int] main.c:5:6: warning: type defaults to 'int' in declaration of 'ccnt' [-Wimplicit-int] 5 | rcnt,ccnt; | ^~~~ main.c:7:1: warning: data definition has no type or storage class 7 | n,k,q; | ^ main.c:7:1: warning: type defaults to 'int' in declaration of 'n' [-Wimplicit-int] main.c:7:3: warning: type defaults to 'int' in declaration of 'k' [-Wimplicit-int] 7 | n,k,q; | ^ main.c:7:5: warning: type defaults to 'int' in declaration of 'q' [-Wimplicit-int] 7 | n,k,q; | ^ main.c:8:1: warning: return type defaults to 'int' [-Wimplicit-int] 8 | main(){ | ^~~~ main.c: In function 'main': main.c:9:9: warning: implicit declaration of function 'scanf' [-Wimplicit-function-declaration] 9 | scanf("%d%d%d\n",&n,&k,&q); | ^~~~~ main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf' +++ |+#include <stdio.h> 1 | char ch[100010]; main.c:9:9: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch] 9 | scanf("%d%d%d\n",&n,&k,&q); | ^~~~~ main.c
ソースコード
char ch[100010]; num[100010]; color[100010]; r[100010],c[100010]; rcnt,ccnt; long ans[100010]; n,k,q; main(){ scanf("%d%d%d\n",&n,&k,&q); for(int i=0;i<q;i++)scanf("%c%d%d\n",ch+i,num+i,color+i); while(q--){ // printf("%c%d%d\n",ch[q],num[q],color[q]); if(ch[q]=='C'){ if(!c[num[q]]++){ ans[color[q]]+=n-rcnt; ccnt++; } }else{ if(!r[num[q]]++){ ans[color[q]]+=n-ccnt; rcnt++; } } // for(int i=1;i<=k;i++)printf("%ld ",ans[i]);puts(""); } long temp=0; for(int i=1;i<=k;i++)temp+=ans[i]; ans[1]+=1LL*n*n-temp; for(int i=1;i<=k;i++)printf("%ld\n",ans[i]); }