QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#409878 | #6776. Garden | ksu_# | 6 | 96ms | 3900kb | C++23 | 3.3kb | 2024-05-12 20:33:51 | 2024-05-12 20:33:51 |
Judging History
answer
#include <iostream>
#include <vector>
#include <string>
#include <math.h>
#include <cmath>
#include <iomanip>
#include <cstdio>
#include <algorithm>
#include <numeric>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <deque>
#include <bitset>
#include <cstring>
#include <unordered_map>
using namespace std;
typedef long long ll;
int main(){
ll n, m, d;
cin >> n >> m >> d;
vector<pair<ll, ll>> a(n), b(m);
for(auto &i: a)
cin >> i.first >> i.second;
for(auto &i: b)
cin >> i.first >> i.second;
ll ans = d * d;
for(int a0 = 1; a0 <= d; a0++){
for(int b0 = 1; b0 <= d; b0++){
if(a0 * b0 >= ans)
continue;
bool end0 = false;
for(int i = 0; i < d && !end0; i++){
for(int j = 0; j < d; j++){
bool ok = false;
for(auto p: b){
if(j % d <= (j + b0 - 1) % d){
if(j % d <= p.first && p.first <= (j + b0 - 1) % d)
continue;
}
else{
if(p.first >= j % d || p.first <= (j + b0 - 1) % d)
continue;
}
if(i % d <= (i + a0 - 1) % d){
if(i % d <= p.second && p.second <= (i + a0 - 1) % d)
continue;
}
else{
if(p.second >= i % d || p.second <= (i + a0 - 1) % d)
continue;
}
ok = true;
break;
}
for(auto p: a){
bool flag1 = false, flag2 = false;
if(j % d <= (j + b0 - 1) % d){
if(j % d <= p.first && p.first <= (j + b0 - 1) % d)
flag1 = true;
}
else{
if(p.first >= j % d || p.first <= (j + b0 - 1) % d)
flag1 = true;
}
if(i % d <= (i + a0 - 1) % d){
if(i % d <= p.second && p.second <= (i + a0 - 1) % d)
flag2 = true;
}
else{
if(p.second >= i % d || p.second <= (i + a0 - 1) % d)
flag2 = true;
}
if(!flag1 || !flag2){
ok = true;
break;
}
}
if(!ok){
ans = a0 * b0;
end0 = true;
break;
}
}
}
}
}
cout << ans << endl;
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Subtask #1:
score: 0
Time Limit Exceeded
Test #1:
score: 0
Time Limit Exceeded
input:
499986 5 1979 299 1572 1897 274 119 291 206 1287 816 937 1922 1376 1676 57 1106 1706 1534 176 678 606 722 473 399 727 1682 1736 221 506 1413 1857 523 1730 1699 346 1056 1287 801 1017 314 1938 1872 189 1750 581 1846 1937 37 1840 1760 725 1465 1222 678 1203 1422 1930 1273 195 730 1930 232 1666 860 352...
output:
result:
Subtask #2:
score: 6
Accepted
Test #11:
score: 6
Accepted
time: 0ms
memory: 3668kb
input:
4835 162 4 0 3 0 2 2 0 0 0 2 3 2 3 2 1 2 0 2 2 2 0 0 1 2 2 2 0 0 0 2 2 0 1 0 1 2 1 0 1 0 2 0 0 2 3 2 2 0 0 2 0 0 3 0 3 2 0 0 1 2 1 2 1 2 2 2 2 0 0 2 2 2 0 0 2 0 0 2 2 0 1 2 2 2 1 0 3 0 0 0 1 0 3 0 3 0 3 0 2 2 1 2 2 0 2 0 2 2 3 2 2 2 1 2 3 0 3 2 0 2 2 2 0 2 2 0 0 0 0 2 3 2 0 0 2 0 1 0 0 2 2 0 1 2 1 2...
output:
12
result:
ok single line: '12'
Test #12:
score: 0
Accepted
time: 3ms
memory: 3900kb
input:
1759 3239 7 5 5 2 5 3 5 3 5 2 5 1 5 3 5 4 5 5 5 1 5 3 5 5 5 2 5 5 5 5 5 2 5 4 5 1 5 1 5 4 5 2 5 3 5 1 5 4 5 5 5 1 5 2 5 1 5 1 5 3 5 4 5 2 5 1 5 2 5 5 5 2 5 2 5 4 5 3 5 2 5 4 5 5 5 5 5 2 5 3 5 4 5 1 5 2 5 4 5 3 5 3 5 3 5 4 5 5 5 3 5 3 5 1 5 5 5 1 5 3 5 1 5 5 5 4 5 3 5 5 5 3 5 4 5 2 5 5 5 2 5 2 5 2 5 ...
output:
5
result:
ok single line: '5'
Test #13:
score: 0
Accepted
time: 2ms
memory: 3692kb
input:
8 4992 10 8 3 8 3 8 3 8 3 8 3 8 3 8 3 8 3 9 0 2 9 6 2 4 5 2 5 6 9 0 0 3 4 7 6 6 8 9 1 5 6 4 7 3 8 1 9 7 8 6 7 6 4 9 5 9 5 7 2 6 4 9 5 5 2 5 0 2 9 9 1 1 8 9 7 9 8 3 4 1 2 3 5 1 1 6 8 4 5 4 2 2 9 2 9 1 0 4 8 2 9 7 2 4 5 5 7 5 8 3 6 2 1 0 6 2 8 9 5 1 6 4 2 4 7 2 1 1 9 2 5 3 8 1 4 9 6 9 2 9 8 5 1 9 7 5 ...
output:
10
result:
ok single line: '10'
Test #14:
score: 0
Accepted
time: 0ms
memory: 3636kb
input:
9 4988 10 8 1 8 1 8 1 8 1 8 1 8 1 8 1 8 1 8 1 9 4 4 9 4 0 6 7 4 2 3 9 7 5 0 9 3 9 3 8 1 9 7 9 6 4 7 5 9 4 5 4 5 7 5 4 2 6 1 6 3 8 4 0 9 4 0 7 6 5 5 4 9 8 0 3 9 7 3 6 7 9 2 5 2 8 4 6 0 3 7 9 4 2 1 0 4 0 1 8 0 7 5 8 6 9 7 5 5 7 5 0 3 3 1 8 9 7 2 3 0 3 1 7 6 7 4 2 5 0 1 7 9 3 3 3 4 9 7 9 0 7 7 5 7 8 7 ...
output:
10
result:
ok single line: '10'
Test #15:
score: 0
Accepted
time: 3ms
memory: 3636kb
input:
7 4991 10 2 4 2 4 2 4 2 4 2 4 2 4 2 4 5 0 4 7 8 9 0 1 5 0 9 5 8 9 1 2 4 7 1 2 6 8 6 8 7 7 7 7 3 5 8 9 7 7 9 5 4 7 0 1 0 1 5 0 5 0 4 7 4 7 5 0 0 1 1 2 7 7 5 0 3 5 3 5 8 9 8 9 9 5 7 7 5 0 0 1 5 0 8 9 9 5 8 9 9 5 8 9 9 5 5 0 6 8 4 7 6 8 3 5 0 1 0 1 6 8 5 0 4 7 3 5 3 5 5 0 3 5 1 2 5 0 7 7 8 9 7 7 1 2 6 ...
output:
9
result:
ok single line: '9'
Test #16:
score: 0
Accepted
time: 31ms
memory: 3876kb
input:
13 4984 10 7 0 4 5 4 0 4 0 6 5 6 5 6 8 7 5 4 0 7 8 4 5 7 8 6 5 1 1 1 1 9 7 0 7 5 9 8 6 8 4 1 1 5 4 0 4 1 6 2 7 2 2 8 1 1 7 0 4 3 7 0 9 5 6 9 7 2 9 5 1 3 1 0 6 2 1 5 1 2 3 2 1 5 1 1 9 9 2 9 9 3 9 8 4 3 3 0 7 2 6 5 7 9 2 2 6 0 9 2 2 2 1 2 7 9 4 0 3 2 2 2 3 2 4 9 6 5 3 9 3 5 7 8 2 5 7 9 3 2 1 3 2 0 7 3...
output:
40
result:
ok single line: '40'
Test #17:
score: 0
Accepted
time: 59ms
memory: 3612kb
input:
5 4990 10 0 4 7 7 2 8 3 9 6 3 1 2 4 5 5 5 9 2 5 5 8 0 8 2 5 5 9 2 4 6 5 2 5 0 8 1 9 5 4 2 8 1 1 2 9 2 5 6 4 2 4 6 1 0 8 2 9 2 1 6 5 1 5 5 4 1 1 1 4 0 5 5 1 6 1 1 8 6 1 2 4 0 8 1 8 2 9 2 8 5 9 1 1 0 4 2 1 5 1 0 5 1 5 1 9 0 1 1 5 1 9 6 1 5 9 2 4 0 5 6 1 6 4 0 4 0 4 2 4 2 8 1 9 0 9 5 8 1 9 5 1 0 1 2 4 ...
output:
70
result:
ok single line: '70'
Test #18:
score: 0
Accepted
time: 73ms
memory: 3896kb
input:
13 4987 10 5 8 0 5 6 8 2 0 2 4 7 7 6 7 0 4 7 7 7 0 6 0 0 5 0 8 8 6 4 1 3 3 8 6 4 1 1 3 8 6 9 9 1 3 4 1 9 9 4 1 8 6 9 9 8 6 1 3 8 6 4 1 3 3 4 1 9 9 9 9 8 6 8 6 4 1 1 3 8 6 3 3 9 9 1 3 3 3 8 6 1 3 1 3 8 6 1 3 4 1 3 3 8 6 3 3 1 3 4 1 3 3 8 6 9 9 1 3 9 9 8 6 8 6 9 9 4 1 8 6 8 6 4 1 4 1 9 9 8 6 3 3 3 3 8...
output:
56
result:
ok single line: '56'
Test #19:
score: 0
Accepted
time: 96ms
memory: 3636kb
input:
16 4983 10 4 8 1 3 7 6 9 1 5 7 7 2 5 2 8 0 2 4 3 8 4 8 4 4 9 9 7 8 6 7 0 5 9 6 9 6 9 6 9 6 9 6 9 6 9 6 9 6 9 6 9 6 9 6 9 6 9 6 9 6 9 6 9 6 9 6 9 6 9 6 9 6 9 6 9 6 9 6 9 6 9 6 9 6 9 6 9 6 9 6 9 6 9 6 9 6 9 6 9 6 9 6 9 6 9 6 9 6 9 6 9 6 9 6 9 6 9 6 9 6 9 6 9 6 9 6 9 6 9 6 9 6 9 6 9 6 9 6 9 6 9 6 9 6 9...
output:
100
result:
ok single line: '100'
Test #20:
score: 0
Accepted
time: 0ms
memory: 3640kb
input:
4977 20 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...
output:
1
result:
ok single line: '1'
Test #21:
score: 0
Accepted
time: 1ms
memory: 3640kb
input:
3 4997 2 0 1 0 1 0 1 0 0 1 1 0 1 1 1 1 1 0 0 0 1 0 1 0 0 0 1 0 1 1 0 1 1 0 1 0 1 1 1 1 1 1 1 0 1 0 1 1 1 0 0 1 1 1 0 0 0 1 1 0 1 1 0 0 0 1 0 1 0 0 1 0 0 0 0 1 0 1 1 1 0 1 0 1 0 1 1 1 1 0 1 0 0 0 0 0 0 0 0 0 1 0 0 1 0 0 1 1 1 1 1 1 0 1 1 0 0 0 0 1 1 1 1 1 1 0 0 0 1 0 1 1 1 0 1 1 0 1 0 0 1 0 0 0 1 1 1...
output:
2
result:
ok single line: '2'
Subtask #3:
score: 0
Time Limit Exceeded
Dependency #2:
100%
Accepted
Test #22:
score: 0
Time Limit Exceeded
input:
2098 2896 47 18 20 23 28 6 4 5 4 29 4 21 20 24 17 7 20 21 37 7 37 44 44 23 44 18 37 7 4 4 4 5 26 29 37 16 28 14 20 38 44 29 44 24 17 24 37 21 11 29 11 5 20 5 44 23 26 2 32 7 4 14 4 6 33 7 20 2 44 3 17 16 17 20 4 14 17 16 4 44 17 3 44 16 33 7 11 4 32 18 44 3 44 21 33 23 17 2 26 18 20 4 23 16 44 16 11...
output:
result:
Subtask #4:
score: 0
Skipped
Dependency #3:
0%
Subtask #5:
score: 0
Skipped
Dependency #4:
0%
Subtask #6:
score: 0
Skipped
Dependency #1:
0%