Submission #65923876
Source Code Expand
#include <stdio.h>
int main(void){
int H, W, N;
scanf("%d %d %d", &H, &W, &N);
int X[N], Y[N];
for(int i = 0; i < N; i++){
scanf("%d %d", &X[i], &Y[i]); // 1 ≤ X[i] ≤ H, 1 ≤ Y[i] ≤ W
}
// 1〜H,1〜W で直接インデックスできるように VLA を 1 大きく取る
int MAP[H+1][W+1];
for(int i = 1; i <= H; i++){
for(int j = 1; j <= W; j++){
MAP[i][j] = 0;
}
}
// ゴミをマーク
for(int i = 0; i < N; i++){
MAP[X[i]][Y[i]] = 1;
}
int Q;
scanf("%d", &Q);
while(Q--){
int axis, idx;
scanf("%d %d", &axis, &idx);
int garbage = 0;
if(axis == 1){
// 行 idx のゴミを数えて捨てる
for(int j = 1; j <= W; j++){
garbage += MAP[idx][j];
MAP[idx][j] = 0;
}
} else {
// 列 idx のゴミを数えて捨てる
for(int i = 1; i <= H; i++){
garbage += MAP[i][idx];
MAP[i][idx] = 0;
}
}
printf("%d\n", garbage);
}
return 0;
}
Submission Info
| Submission Time | |
|---|---|
| Task | D - Garbage Removal |
| User | oinucha |
| Language | C (gcc 12.2.0) |
| Score | 0 |
| Code Size | 1196 Byte |
| Status | RE |
| Exec Time | 467 ms |
| Memory | 1051000 KiB |
Compile Error
Main.c: In function ‘main’:
Main.c:5:5: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
5 | scanf("%d %d %d", &H, &W, &N);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Main.c:9:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
9 | scanf("%d %d", &X[i], &Y[i]); // 1 ≤ X[i] ≤ H, 1 ≤ Y[i] ≤ W
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
Main.c:25:5: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
25 | scanf("%d", &Q);
| ^~~~~~~~~~~~~~~
Main.c:28:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
28 | scanf("%d %d", &axis, &idx);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~
Judge Result
| Set Name | Sample | All | ||||||
|---|---|---|---|---|---|---|---|---|
| Score / Max Score | 0 / 0 | 0 / 400 | ||||||
| Status |
|
|
| Set Name | Test Cases |
|---|---|
| Sample | sample00.txt, sample01.txt, sample02.txt |
| All | sample00.txt, sample01.txt, sample02.txt, testcase00.txt, testcase01.txt, testcase02.txt, testcase03.txt, testcase04.txt, testcase05.txt, testcase06.txt, testcase07.txt, testcase08.txt, testcase09.txt, testcase10.txt, testcase11.txt, testcase12.txt, testcase13.txt, testcase14.txt, testcase15.txt, testcase16.txt, testcase17.txt, testcase18.txt, testcase19.txt, testcase20.txt, testcase21.txt, testcase22.txt, testcase23.txt, testcase24.txt, testcase25.txt, testcase26.txt, testcase27.txt, testcase28.txt, testcase29.txt, testcase30.txt, testcase31.txt, testcase32.txt, testcase33.txt, testcase34.txt, testcase35.txt, testcase36.txt |
| Case Name | Status | Exec Time | Memory |
|---|---|---|---|
| sample00.txt | AC | 0 ms | 1592 KiB |
| sample01.txt | AC | 0 ms | 1616 KiB |
| sample02.txt | AC | 0 ms | 1704 KiB |
| testcase00.txt | RE | 442 ms | 1050956 KiB |
| testcase01.txt | RE | 466 ms | 1050956 KiB |
| testcase02.txt | RE | 445 ms | 1050968 KiB |
| testcase03.txt | RE | 467 ms | 1050996 KiB |
| testcase04.txt | RE | 459 ms | 1050996 KiB |
| testcase05.txt | RE | 467 ms | 1050984 KiB |
| testcase06.txt | RE | 459 ms | 1050944 KiB |
| testcase07.txt | RE | 467 ms | 1050932 KiB |
| testcase08.txt | RE | 467 ms | 1050992 KiB |
| testcase09.txt | RE | 461 ms | 1050928 KiB |
| testcase10.txt | RE | 466 ms | 1050916 KiB |
| testcase11.txt | RE | 460 ms | 1050972 KiB |
| testcase12.txt | RE | 467 ms | 1050888 KiB |
| testcase13.txt | RE | 456 ms | 1050928 KiB |
| testcase14.txt | RE | 462 ms | 1050940 KiB |
| testcase15.txt | RE | 454 ms | 1050896 KiB |
| testcase16.txt | RE | 461 ms | 1050896 KiB |
| testcase17.txt | RE | 453 ms | 1050988 KiB |
| testcase18.txt | RE | 461 ms | 1050916 KiB |
| testcase19.txt | RE | 444 ms | 1050900 KiB |
| testcase20.txt | RE | 460 ms | 1050944 KiB |
| testcase21.txt | RE | 452 ms | 1050920 KiB |
| testcase22.txt | RE | 462 ms | 1050976 KiB |
| testcase23.txt | RE | 460 ms | 1050944 KiB |
| testcase24.txt | RE | 461 ms | 1050992 KiB |
| testcase25.txt | RE | 459 ms | 1050908 KiB |
| testcase26.txt | RE | 462 ms | 1050896 KiB |
| testcase27.txt | RE | 451 ms | 1050904 KiB |
| testcase28.txt | RE | 461 ms | 1050884 KiB |
| testcase29.txt | RE | 445 ms | 1050872 KiB |
| testcase30.txt | RE | 461 ms | 1050960 KiB |
| testcase31.txt | RE | 449 ms | 1050904 KiB |
| testcase32.txt | RE | 459 ms | 1051000 KiB |
| testcase33.txt | RE | 447 ms | 1050960 KiB |
| testcase34.txt | RE | 461 ms | 1050988 KiB |
| testcase35.txt | RE | 441 ms | 1050952 KiB |
| testcase36.txt | RE | 461 ms | 1050968 KiB |