結果
| 問題 |
No.230 Splarraay スプラレェーイ
|
| コンテスト | |
| ユーザー |
カルロス
|
| 提出日時 | 2015-09-23 10:07:10 |
| 言語 | C90 (gcc 12.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,361 bytes |
| コンパイル時間 | 346 ms |
| コンパイル使用メモリ | 21,248 KB |
| 実行使用メモリ | 8,732 KB |
| 最終ジャッジ日時 | 2024-07-19 08:46:47 |
| 合計ジャッジ時間 | 13,150 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | WA * 3 |
| other | WA * 12 TLE * 1 -- * 4 |
コンパイルメッセージ
main.c: In function ‘main’:
main.c:8:5: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
8 | scanf("%d %d", &N, &Q);
| ^~~~~~~~~~~~~~~~~~~~~~
main.c:10:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
10 | scanf("%d %d %d", &x, &l, &r);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ソースコード
#include <stdio.h>
int main(void){
int i, j, N, Q, x, l, r, c1, c2, score_1 = 0, score_2 = 0;
int field[100000] = {0};
scanf("%d %d", &N, &Q);
for(i=0;i<Q;i++){
scanf("%d %d %d", &x, &l, &r);
if(x==0){
c1 = 0, c2 = 0;
for(j=l;j<=r;j++){
if (field[j]==1){
c1++;
}else if(field[j]==2){
c2++;
}
}
if (c1>c2){
score_1 += c1;
}else if(c1<c2){
score_2 += c2;
}
}else if(x==1){
for(j=l;j<=r;j++){
if (field[j]==0){
field[j] = 1;
score_1++;
}else if(field[j]==2){
field[j] = 1;
score_1++;
score_2--;
}
}
}else{
for(j=l;j<=r;j++){
if (field[j]==0){
field[j] = 2;
score_2++;
}else if(field[j]==1){
field[j] = 2;
score_1--;
score_2++;
}
}
}
printf("1 = %d, 2 = %d\n", score_1, score_2);
}
printf("%d %d\n", score_1, score_2);
return 0;
}
カルロス