結果
| 問題 |
No.230 Splarraay スプラレェーイ
|
| コンテスト | |
| ユーザー |
るさ
|
| 提出日時 | 2018-05-31 20:32:26 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 956 bytes |
| コンパイル時間 | 402 ms |
| コンパイル使用メモリ | 23,552 KB |
| 実行使用メモリ | 7,168 KB |
| 最終ジャッジ日時 | 2024-06-30 08:38:40 |
| 合計ジャッジ時間 | 8,639 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 11 TLE * 1 -- * 5 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:5:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
5 | scanf("%d",&n);
| ~~~~~^~~~~~~~~
main.cpp:6:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
6 | scanf("%d",&q);
| ~~~~~^~~~~~~~~
main.cpp:17:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
17 | scanf("%d",&t);
| ~~~~~^~~~~~~~~
main.cpp:18:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
18 | scanf("%d",&s);
| ~~~~~^~~~~~~~~
main.cpp:19:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
19 | scanf("%d",&e);
| ~~~~~^~~~~~~~~
ソースコード
#include <stdio.h>
int main(void){
int n;
int q;
scanf("%d",&n);
scanf("%d",&q);
int field[n];
for(int i=0;i<n;i++){
field[i]=0;
}
int abo=0;
int bbo=0;
for(int i=0;i<q;i++){
int t;
int s;
int e;
scanf("%d",&t);
scanf("%d",&s);
scanf("%d",&e);
if(t==0){
int acnt=0;
int bcnt=0;
for(int j=s;j<=e;j++){
acnt+=field[j]==1;
bcnt+=field[j]==2;
}
if(acnt>bcnt){
abo+=acnt;
}else if(acnt<bcnt){
bbo+=bcnt;
}
}else{
for(int j=s;j<=e;j++){
field[j]=t;
}
}
}
int acnt=0;
int bcnt=0;
for(int j=0;j<n;j++){
acnt+=field[j]==1;
bcnt+=field[j]==2;
}
printf("%d",abo+acnt);
printf("%s"," ");
printf("%d",bbo+bcnt);
}
るさ