Submission #41960517
Source Code Expand
Copy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#include <bits/stdc++.h>
using namespace std;
#define mp make_pair
#define pb push_back
#define int long long
#define pii pair<int, int>
#define fi first
#define se second
#define all(v) v.begin(), v.end()
#define trace(x) cout << '>' << #x << ':' << x << "\n"
#define trace2(x,y) cout<< '>' << #x << ':' << x << " | " << #y << ':' << y << "\n"
#define trace3(a,b,c) cout<<#a<<"="<<(a)<<", "<<#b<<"="<<(b)<<", "<<#c<<"="<<(c)<<"\n"
#define trace4(a,b,c,d) cout<<#a<<"="<<(a)<<", "<<#b<<"="<<(b)<<", "<<#c<<"="<<(c)<<", "<<#d<<"="<<(d)<<"\n"
template <typename T>
void print(T var){
cout << var << ' ';
return;
}
template <typename T>
void print(vector <T> var){
for (auto x: var)
print(x);
cout << "\n";
return;
}
int dx[4] = {-1, 0, 1, 0};
int dy[4] = {0, -1, 0, 1};
const int mod = 1e9+7;
signed main(){
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
int w, h;
cin >> w >> h;
int n;
cin >> n;
vector<pair<pii,int>> v(n);
for (int i = 0; i < n; i++) {
int a, b;
cin >> a >> b;
v[i] = {{a,b},i};
}
sort(all(v));
int A;
cin >> A;
int it = -1;
vector<pii> ans(n,{1e9,1e9});
for (int i = 0; i < A; i++) {
int x;
cin >> x;
while (it+1<n&&v[it+1].fi.fi<x) {
it++;
ans[v[it].se].fi = i;
}
}
for (int i = 0; i < n; i++) {
swap(v[i].fi.fi, v[i].fi.se);
}
sort(all(v));
int B;
cin >> B;
it = -1;
for (int i = 0; i < B; i++) {
int y;
cin >> y;
while (it+1<n&&v[it+1].fi.fi<y) {
it++;
ans[v[it].se].se = i;
}
}
map<pair<int,int>,int> m;
for (int i = 0; i < n; i++) {
m[ans[i]]++;
}
int mn = INT_MAX, mx = INT_MIN;
int cnt = 0;
for (auto it = m.begin(); it != m.end(); it++) {
cnt++;
// pii cur = it->first;
// trace3(cur.fi, cur.se, it->second);
mn = min(mn, it->second);
mx = max(mx, it->second);
}
if (cnt!=(A+1)*(B+1)) mn = 0;
cout << mn << ' ' << mx;
}
Submission Info
Submission Time |
|
Task |
D - A Piece of Cake |
User |
Nur47 |
Language |
C++ (GCC 9.2.1) |
Score |
400 |
Code Size |
2238 Byte |
Status |
AC |
Exec Time |
235 ms |
Memory |
23508 KB |
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 |
75 ms |
10996 KB |
001.txt |
AC |
79 ms |
10992 KB |
002.txt |
AC |
78 ms |
10920 KB |
003.txt |
AC |
80 ms |
10976 KB |
004.txt |
AC |
81 ms |
11052 KB |
005.txt |
AC |
176 ms |
23096 KB |
006.txt |
AC |
189 ms |
23400 KB |
007.txt |
AC |
189 ms |
23416 KB |
008.txt |
AC |
200 ms |
23508 KB |
009.txt |
AC |
181 ms |
23448 KB |
010.txt |
AC |
170 ms |
23508 KB |
011.txt |
AC |
109 ms |
10948 KB |
012.txt |
AC |
109 ms |
11008 KB |
013.txt |
AC |
111 ms |
11028 KB |
014.txt |
AC |
109 ms |
11004 KB |
015.txt |
AC |
151 ms |
17084 KB |
016.txt |
AC |
154 ms |
17112 KB |
017.txt |
AC |
152 ms |
17104 KB |
018.txt |
AC |
146 ms |
17104 KB |
019.txt |
AC |
190 ms |
23356 KB |
020.txt |
AC |
103 ms |
11012 KB |
021.txt |
AC |
61 ms |
8628 KB |
022.txt |
AC |
107 ms |
15228 KB |
023.txt |
AC |
135 ms |
20008 KB |
024.txt |
AC |
173 ms |
22448 KB |
025.txt |
AC |
102 ms |
12796 KB |
026.txt |
AC |
198 ms |
23400 KB |
027.txt |
AC |
205 ms |
23424 KB |
028.txt |
AC |
188 ms |
23332 KB |
029.txt |
AC |
232 ms |
23420 KB |
030.txt |
AC |
235 ms |
23400 KB |
031.txt |
AC |
102 ms |
12140 KB |
032.txt |
AC |
92 ms |
11184 KB |
033.txt |
AC |
93 ms |
10976 KB |
034.txt |
AC |
87 ms |
11056 KB |
035.txt |
AC |
89 ms |
11016 KB |
036.txt |
AC |
85 ms |
11032 KB |
037.txt |
AC |
79 ms |
11016 KB |
038.txt |
AC |
86 ms |
11012 KB |
039.txt |
AC |
85 ms |
11028 KB |
040.txt |
AC |
86 ms |
11032 KB |
041.txt |
AC |
84 ms |
10924 KB |
042.txt |
AC |
79 ms |
11012 KB |
example0.txt |
AC |
2 ms |
3528 KB |
example1.txt |
AC |
2 ms |
3576 KB |