Submission #41975092
Source Code Expand
import std;
void read(T...)(string S, ref T args) {
auto buf = S.split;
foreach (i, ref arg; args) {
arg = buf[i].to!(typeof(arg));
}
}
void read_array(T)(string S, ref T[] arg) {
arg = S.split.to!(T[]);
}
struct pair {
int p;
int q;
}
void main () {
int W, H; read(readln, W, H);
int N; read(readln, N);
pair[] cod = new pair[](N);
foreach (i; 0..N) {
read(readln, cod[i].p, cod[i].q);
}
int A; readln.read(A);
int[] a = new int[](A);
read_array(readln, a);
int B; readln.read(B);
int[] b = new int[](B);
read_array(readln, b);
solve(W, H, N, cod, a, b);
}
void solve (int W, int H, int N, pair[] cod, int[] a, int[] b) {
int[pair] map;
a = 0 ~ a;
b = 0 ~ b;
//stderr.writeln(a);
//stderr.writeln(b);
foreach (x; cod) {
int X, Y;
{
int left = 0, right = cast(int)a.length;
while (right - left != 1) {
int center = (left + right) / 2;
if (a[center] < x.p) {
left = center;
} else {
right = center;
}
}
X = left;
}
{
int left = 0, right = cast(int)b.length;
while (right - left != 1) {
int center = (left + right) / 2;
if (b[center] < x.q) {
left = center;
} else {
right = center;
}
}
Y = left;
}
if (pair(X, Y) in map) {
map[pair(X, Y)]++;
} else {
map[pair(X, Y)] = 1;
}
}
//stderr.writeln(map);
int m = int.max, M = 0;
foreach (x; map) {
M = max(M, x);
m = min(m, x);
}
if (map.length < a.length * b.length) {
m = 0;
}
writeln(m, " ", M);
}
Submission Info
| Submission Time | |
|---|---|
| Task | D - A Piece of Cake |
| User | InTheBloom |
| Language | D (DMD 2.091.0) |
| Score | 400 |
| Code Size | 2006 Byte |
| Status | AC |
| Exec Time | 290 ms |
| Memory | 35556 KiB |
Judge Result
| Set Name | Sample | All | ||||
|---|---|---|---|---|---|---|
| Score / Max Score | 0 / 0 | 400 / 400 | ||||
| Status |
|
|
| Set Name | Test Cases |
|---|---|
| Sample | example0.txt, example1.txt |
| All | 000.txt, 001.txt, 002.txt, 003.txt, 004.txt, 005.txt, 006.txt, 007.txt, 008.txt, 009.txt, 010.txt, 011.txt, 012.txt, 013.txt, 014.txt, 015.txt, 016.txt, 017.txt, 018.txt, 019.txt, 020.txt, 021.txt, 022.txt, 023.txt, 024.txt, 025.txt, 026.txt, 027.txt, 028.txt, 029.txt, 030.txt, 031.txt, 032.txt, 033.txt, 034.txt, 035.txt, 036.txt, 037.txt, 038.txt, 039.txt, 040.txt, 041.txt, 042.txt, example0.txt, example1.txt |
| Case Name | Status | Exec Time | Memory |
|---|---|---|---|
| 000.txt | AC | 127 ms | 5896 KiB |
| 001.txt | AC | 132 ms | 6108 KiB |
| 002.txt | AC | 125 ms | 6092 KiB |
| 003.txt | AC | 131 ms | 5928 KiB |
| 004.txt | AC | 130 ms | 5988 KiB |
| 005.txt | AC | 187 ms | 19452 KiB |
| 006.txt | AC | 206 ms | 24296 KiB |
| 007.txt | AC | 198 ms | 24184 KiB |
| 008.txt | AC | 277 ms | 35288 KiB |
| 009.txt | AC | 278 ms | 35436 KiB |
| 010.txt | AC | 286 ms | 35244 KiB |
| 011.txt | AC | 179 ms | 22988 KiB |
| 012.txt | AC | 184 ms | 22676 KiB |
| 013.txt | AC | 189 ms | 22724 KiB |
| 014.txt | AC | 198 ms | 22756 KiB |
| 015.txt | AC | 229 ms | 28272 KiB |
| 016.txt | AC | 238 ms | 28936 KiB |
| 017.txt | AC | 236 ms | 29292 KiB |
| 018.txt | AC | 237 ms | 25980 KiB |
| 019.txt | AC | 287 ms | 35312 KiB |
| 020.txt | AC | 180 ms | 16544 KiB |
| 021.txt | AC | 89 ms | 14920 KiB |
| 022.txt | AC | 165 ms | 23680 KiB |
| 023.txt | AC | 204 ms | 24636 KiB |
| 024.txt | AC | 231 ms | 30940 KiB |
| 025.txt | AC | 158 ms | 19920 KiB |
| 026.txt | AC | 290 ms | 35556 KiB |
| 027.txt | AC | 283 ms | 35504 KiB |
| 028.txt | AC | 279 ms | 35368 KiB |
| 029.txt | AC | 280 ms | 34968 KiB |
| 030.txt | AC | 286 ms | 35492 KiB |
| 031.txt | AC | 155 ms | 6736 KiB |
| 032.txt | AC | 144 ms | 6304 KiB |
| 033.txt | AC | 147 ms | 5932 KiB |
| 034.txt | AC | 140 ms | 5976 KiB |
| 035.txt | AC | 140 ms | 6012 KiB |
| 036.txt | AC | 134 ms | 6064 KiB |
| 037.txt | AC | 131 ms | 6072 KiB |
| 038.txt | AC | 139 ms | 6040 KiB |
| 039.txt | AC | 139 ms | 5984 KiB |
| 040.txt | AC | 139 ms | 13356 KiB |
| 041.txt | AC | 127 ms | 5932 KiB |
| 042.txt | AC | 135 ms | 6108 KiB |
| example0.txt | AC | 2 ms | 3412 KiB |
| example1.txt | AC | 2 ms | 3552 KiB |