Submission #2559796
Source Code Expand
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.HashSet;
import java.util.InputMismatchException;
import java.util.Set;
import java.util.StringTokenizer;
public class Main {
public static void main(String[] args) throws IOException {
InputStream inputStream = System.in;
OutputStream outputStream = System.out;
InputReader in = new InputReader(inputStream);
PrintWriter out = new PrintWriter(outputStream);
TaskX solver = new TaskX();
solver.solve(1, in, out);
out.close();
}
static int INF = 1 << 30;
static int MOD = 1000000007;
static int[] mh4 = { 0, -1, 1, 0 };
static int[] mw4 = { -1, 0, 0, 1 };
static int[] mh8 = { -1, -1, -1, 0, 0, 1, 1, 1 };
static int[] mw8 = { -1, 0, 1, -1, 1, -1, 0, 1 };
static class TaskX {
public void solve(int testNumber, InputReader in, PrintWriter out) {
int h = in.nextInt(), w = in.nextInt(), k = in.nextInt();
int n = in.nextInt();
int[][] map = new int[n][n];
Set<Long> set = new HashSet<>();
int[] H = new int[h], W = new int[w];
for (int i = 0; i < n; i++) {
int r = in.nextInt()-1, c = in.nextInt()-1;
map[r][c] = 1;
H[r]++; W[c]++;
set.add((long)r << 32 | c);
}
long ans = 0;
for (int i = 0; i < h; i++) {
for (int j = 0; j < w; j++) {
int wa = H[i] + W[j];
if (set.contains((long)i << 32 | j)) {
wa--;
}
if (wa == k) {
ans++;
}
}
}
out.println(ans);
}
}
static class InputReader {
BufferedReader in;
StringTokenizer tok;
public String nextString() {
while (!tok.hasMoreTokens()) {
try {
tok = new StringTokenizer(in.readLine(), " ");
} catch (IOException e) {
throw new InputMismatchException();
}
}
return tok.nextToken();
}
public int nextInt() {
return Integer.parseInt(nextString());
}
public long nextLong() {
return Long.parseLong(nextString());
}
public double nextDouble() {
return Double.parseDouble(nextString());
}
public int[] nextIntArray(int n) {
int[] res = new int[n];
for (int i = 0; i < n; i++) {
res[i] = nextInt();
}
return res;
}
public long[] nextLongArray(int n) {
long[] res = new long[n];
for (int i = 0; i < n; i++) {
res[i] = nextLong();
}
return res;
}
public InputReader(InputStream inputStream) {
in = new BufferedReader(new InputStreamReader(inputStream));
tok = new StringTokenizer("");
}
}
}
Submission Info
Submission Time |
|
Task |
C - 収集王 |
User |
tutuz |
Language |
Java8 (OpenJDK 1.8.0) |
Score |
0 |
Code Size |
2685 Byte |
Status |
RE |
Exec Time |
610 ms |
Memory |
922952 KB |
Judge Result
Set Name |
Sample |
Subtask1 |
Subtask2 |
Score / Max Score |
0 / 0 |
0 / 30 |
0 / 70 |
Status |
|
|
|
Set Name |
Test Cases |
Sample |
subtask0-sample01.txt, subtask0-sample02.txt, subtask0-sample03.txt |
Subtask1 |
subtask0-sample01.txt, subtask0-sample02.txt, subtask0-sample03.txt, subtask1-01.txt, subtask1-02.txt, subtask1-03.txt, subtask1-04.txt, subtask1-05.txt, subtask1-06.txt, subtask1-07.txt, subtask1-08.txt, subtask1-09.txt, subtask1-10.txt, subtask1-11.txt, subtask1-12.txt, subtask1-13.txt, subtask1-14.txt, subtask1-15.txt |
Subtask2 |
subtask0-sample01.txt, subtask0-sample02.txt, subtask0-sample03.txt, subtask1-01.txt, subtask1-02.txt, subtask1-03.txt, subtask1-04.txt, subtask1-05.txt, subtask1-06.txt, subtask1-07.txt, subtask1-08.txt, subtask1-09.txt, subtask1-10.txt, subtask1-11.txt, subtask1-12.txt, subtask1-13.txt, subtask1-14.txt, subtask1-15.txt, subtask2-01.txt, subtask2-02.txt, subtask2-03.txt, subtask2-04.txt, subtask2-05.txt, subtask2-06.txt, subtask2-07.txt, subtask2-08.txt, subtask2-09.txt, subtask2-10.txt, subtask2-11.txt, subtask2-12.txt, subtask2-13.txt, subtask2-14.txt, subtask2-15.txt |
Case Name |
Status |
Exec Time |
Memory |
subtask0-sample01.txt |
AC |
72 ms |
18900 KB |
subtask0-sample02.txt |
AC |
73 ms |
18772 KB |
subtask0-sample03.txt |
AC |
70 ms |
21332 KB |
subtask1-01.txt |
RE |
76 ms |
19284 KB |
subtask1-02.txt |
RE |
73 ms |
19924 KB |
subtask1-03.txt |
AC |
71 ms |
19540 KB |
subtask1-04.txt |
RE |
71 ms |
19412 KB |
subtask1-05.txt |
RE |
71 ms |
17620 KB |
subtask1-06.txt |
RE |
70 ms |
21332 KB |
subtask1-07.txt |
AC |
73 ms |
21460 KB |
subtask1-08.txt |
AC |
84 ms |
19668 KB |
subtask1-09.txt |
AC |
72 ms |
17748 KB |
subtask1-10.txt |
AC |
84 ms |
18388 KB |
subtask1-11.txt |
AC |
73 ms |
19412 KB |
subtask1-12.txt |
AC |
73 ms |
18772 KB |
subtask1-13.txt |
AC |
72 ms |
19412 KB |
subtask1-14.txt |
AC |
75 ms |
21460 KB |
subtask1-15.txt |
AC |
74 ms |
21332 KB |
subtask2-01.txt |
AC |
132 ms |
32468 KB |
subtask2-02.txt |
AC |
193 ms |
77524 KB |
subtask2-03.txt |
MLE |
610 ms |
922952 KB |
subtask2-04.txt |
MLE |
560 ms |
873940 KB |
subtask2-05.txt |
MLE |
548 ms |
870100 KB |
subtask2-06.txt |
MLE |
545 ms |
869076 KB |
subtask2-07.txt |
MLE |
545 ms |
869588 KB |
subtask2-08.txt |
MLE |
545 ms |
869972 KB |
subtask2-09.txt |
MLE |
551 ms |
877396 KB |
subtask2-10.txt |
MLE |
555 ms |
876372 KB |
subtask2-11.txt |
MLE |
556 ms |
875988 KB |
subtask2-12.txt |
MLE |
552 ms |
873428 KB |
subtask2-13.txt |
MLE |
601 ms |
920788 KB |
subtask2-14.txt |
MLE |
544 ms |
870484 KB |
subtask2-15.txt |
MLE |
553 ms |
877908 KB |