結果
問題 |
No.230 Splarraay スプラレェーイ
|
ユーザー |
![]() |
提出日時 | 2015-07-26 20:10:12 |
言語 | C90 (gcc 12.3.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 685 bytes |
コンパイル時間 | 236 ms |
コンパイル使用メモリ | 22,016 KB |
実行使用メモリ | 6,784 KB |
最終ジャッジ日時 | 2024-07-08 14:15:49 |
合計ジャッジ時間 | 9,701 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 11 TLE * 1 -- * 5 |
コンパイルメッセージ
main.c: In function ‘main’: main.c:9:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 9 | scanf("%d",&N); | ^~~~~~~~~~~~~~ main.c:17:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 17 | scanf("%d",&Q); | ^~~~~~~~~~~~~~ main.c:23:17: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 23 | scanf("%d%d%d",&x,&l,&r); | ^~~~~~~~~~~~~~~~~~~~~~~~
ソースコード
#include<stdio.h> #include<stdlib.h> typedef long long int ln; int main(void){ int N; scanf("%d",&N); char *ary; ary=(char *)malloc(sizeof(char)*N); int i; for(i=0;i<N;i++) ary[i]=0; int Q; scanf("%d",&Q); ln a,b; a=b=0; for(i=0;i<Q;i++){ int x,l,r; scanf("%d%d%d",&x,&l,&r); if(x==0){ int t[3]; t[1]=t[2]=0; int j; for(j=l;j<=r;j++){ t[ary[j]]++; } if(t[1]!=t[2]){ if(t[1]>t[2]){ a+=t[1]; } else { b+=t[2]; } } } else { int j; for(j=l;j<=r;j++){ ary[j]=x; } } } for(i=0;i<N;i++){ if(ary[i]==1){ a++; } if(ary[i]==2){ b++; } } printf("%lld %lld\n",a,b); free(ary); return 0; }