QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#443413 | #8646. Card Collection | green_gold_dog# | 0 | 0ms | 3852kb | C++23 | 2.6kb | 2024-06-15 15:29:11 | 2024-06-15 15:29:26 |
answer
//#pragma GCC optimize("Ofast")
//#pragma GCC target("avx,avx2,sse,sse2,sse3,ssse3,sse4,abm,popcnt,mmx")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double db;
typedef long double ldb;
typedef complex<double> cd;
constexpr ll INF64 = 9'000'000'000'000'000'000, INF32 = 2'000'000'000, MOD = 1'000'000'007;
constexpr db PI = acos(-1);
constexpr bool IS_FILE = false, IS_TEST_CASES = false;
random_device rd;
mt19937 rnd32(rd());
mt19937_64 rnd64(rd());
template<typename T>
bool assign_max(T& a, T b) {
if (b > a) {
a = b;
return true;
}
return false;
}
template<typename T>
bool assign_min(T& a, T b) {
if (b < a) {
a = b;
return true;
}
return false;
}
template<typename T>
T square(T a) {
return a * a;
}
template<>
struct std::hash<pair<ll, ll>> {
ll operator() (pair<ll, ll> p) const {
return ((__int128)p.first * MOD + p.second) % INF64;
}
};
void solve() {
ll n, m;
cin >> n >> m;
vector<pair<ll, ll>> all(n);
map<ll, ll> maxf, minf, maxs, mins;
multiset<ll> af, as;
for (ll i = 0; i < n; i++) {
cin >> all[i].first >> all[i].second;
af.insert(all[i].first);
as.insert(all[i].second);
maxf[all[i].first] = 0;
minf[all[i].first] = INF32;
maxs[all[i].second] = 0;
mins[all[i].second] = INF32;
}
for (auto[a, b] : all) {
assign_max(maxf[a], b);
assign_min(minf[a], b);
assign_max(maxs[b], a);
assign_min(mins[b], a);
}
for (ll i = 1; i <= m; i++) {
ll a, b;
cin >> a >> b;
if (af.find(a) == af.end() || as.find(b) == as.end()) {
continue;
}
if ((maxf[a] >= b && maxs[b] >= a) || (minf[a] <= b && mins[b] <= a)) {
cout << i << ' ';
}
}
cout << '\n';
}
int main() {
if (IS_FILE) {
freopen("", "r", stdin);
freopen("", "w", stdout);
}
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
ll t = 1;
if (IS_TEST_CASES) {
cin >> t;
}
for (ll i = 0; i < t; i++) {
solve();
}
}
Details
Tip: Click on the bar to expand more detailed information
Subtask #1:
score: 0
Wrong Answer
Test #1:
score: 11
Accepted
time: 0ms
memory: 3548kb
input:
2 10 171631799 561094698 171631799 867698918 126573648 561094698 171631799 867698918 171631799 561094698 126573648 561094698 126573648 561094698 171631799 561094698 126573648 561094698 126573648 561094698 126573648 561094698 171631799 561094698
output:
2 3 6 10
result:
ok 4 number(s): "2 3 6 10"
Test #2:
score: 0
Accepted
time: 0ms
memory: 3552kb
input:
3 10 713180371 43103927 713180371 136832929 853543805 251852293 892623928 251852293 713180371 136832929 713180371 43103927 853543805 43103927 892623928 136832929 713180371 43103927 853543805 43103927 892623928 136832929 713180371 43103927 892623928 251852293
output:
2 3 6 9
result:
ok 4 number(s): "2 3 6 9"
Test #3:
score: 0
Accepted
time: 0ms
memory: 3840kb
input:
4 10 254412080 855555783 254412080 534954259 610506813 184822793 804271098 233942602 804271098 233942602 536633825 184822793 254412080 855555783 804271098 233942602 536633825 233942602 254412080 855555783 804271098 534954259 610506813 534954259 536633825 184822793 536633825 855555783
output:
1 3 4 6 7 8
result:
ok 6 numbers
Test #4:
score: 0
Accepted
time: 0ms
memory: 3852kb
input:
5 10 148547041 170447714 617759855 170447714 617759855 963162312 148547041 948767426 423489361 460053818 423489361 460053818 817714720 948767426 617759855 673099807 617759855 963162312 617759855 673099807 423489361 460053818 423489361 460053818 817714720 948767426 817714720 170447714 148547041 67309...
output:
1 4 6 7
result:
ok 4 number(s): "1 4 6 7"
Test #5:
score: 0
Accepted
time: 0ms
memory: 3816kb
input:
6 10 452189481 369706489 974106249 369706489 152471743 55874110 152471743 7767562 623180600 783682263 116778263 783682263 974106249 369706489 452189481 7767562 623180600 7767562 116778263 783682263 330861484 7767562 452189481 640079581 974106249 640079581 623180600 783682263 974106249 7767562 116778...
output:
1 4 8
result:
ok 3 number(s): "1 4 8"
Test #6:
score: 0
Accepted
time: 0ms
memory: 3572kb
input:
7 10 546365360 29458595 459505526 682968936 892069847 113227141 892069847 682968936 459505526 895773339 436538726 29458595 892069847 29458595 892069847 21442381 200908509 682968936 84249914 782064261 691849455 682968936 691849455 682968936 691849455 21442381 691849455 682968936 691849455 21442381 84...
output:
result:
ok 0 number(s): ""
Test #7:
score: -11
Wrong Answer
time: 0ms
memory: 3492kb
input:
8 10 53884460 816621582 931458006 534340303 53884460 621933704 317941616 487589985 53884460 793793344 831491668 487589985 53884460 816621582 53884460 417129074 831491668 417129074 317941616 534340303 395845824 793793344 395845824 417129074 317941616 166559933 100528187 487589985 83144683 816621582 8...
output:
10
result:
wrong answer 1st numbers differ - expected: '2', found: '10'
Subtask #2:
score: 0
Skipped
Dependency #1:
0%
Subtask #3:
score: 0
Skipped
Dependency #1:
0%
Subtask #4:
score: 0
Skipped
Dependency #1:
0%