結果
| 問題 | No.3709 Unknown Treasure |
| コンテスト | |
| ユーザー |
ks2m
|
| 提出日時 | 2026-09-11 21:35:59 |
| 言語 | Java (openjdk 26.0.2.1 + ACL) |
| 結果 |
AC
不安定
|
| 実行時間 | 410 ms / 2,000 ms |
| + 319µs | |
| コード長 | 1,080 bytes |
| 記録 | |
| コンパイル時間 | 1,715 ms |
| コンパイル使用メモリ | 85,044 KB |
| 実行使用メモリ | 70,564 KB |
| 最終ジャッジ日時 | 2026-09-11 21:36:32 |
| 合計ジャッジ時間 | 10,497 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge3_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 36 |
ソースコード
import java.io.BufferedReader;
import java.io.InputStreamReader;
public class Main {
public static void main(String[] args) throws Exception {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
String[] sa = br.readLine().split(" ");
int h = Integer.parseInt(sa[0]);
int w = Integer.parseInt(sa[1]);
int n = Integer.parseInt(sa[2]);
int[][] a = new int[h + 1][w + 1];
for (int i = 0; i < n; i++) {
sa = br.readLine().split(" ");
int r1 = Integer.parseInt(sa[0]) - 1;
int c1 = Integer.parseInt(sa[1]) - 1;
int r2 = Integer.parseInt(sa[2]);
int c2 = Integer.parseInt(sa[3]);
a[r1][c1]++;
a[r1][c2]--;
a[r2][c1]--;
a[r2][c2]++;
}
br.close();
for (int i = 0; i < h; i++) {
for (int j = 1; j <= w; j++) {
a[i][j] += a[i][j - 1];
}
}
for (int i = 1; i <= h; i++) {
for (int j = 0; j < w; j++) {
a[i][j] += a[i - 1][j];
}
}
int ans = 0;
for (int i = 0; i < h; i++) {
for (int j = 0; j < w; j++) {
if (a[i][j] == 0) {
ans++;
}
}
}
System.out.println(ans);
}
}
ks2m