Submission #1316503

#TimeUsernameProblemLanguageResultExecution timeMemory
1316503pvproCard Collection (JOI24_collection)C++20
0 / 100
1 ms332 KiB
#ifndef LOCAL #pragma GCC Optimize("O3,Ofast,unroll-loops") #pragma GCC Target("bmi,bmi2,avx,avx2") #endif #include <bits/stdc++.h> using namespace std; using ll = long long; using ld = long double; #define int ll #define f first #define s second #define mp make_pair #define pb push_back #define pii pair<int, int> #define all(x) (x).begin(), (x).end() #define rall(x) (x).rbegin() (x).rend() #ifndef LOCAL #define endl "\n" #endif mt19937 rnd(11); void solve() { int n, m; cin >> n >> m; vector<pii> a(n); for (int i = 0; i < n; ++i) { cin >> a[i].f >> a[i].s; } for (int i = 0; i < m; ++i) { int x, y; cin >> x >> y; vector<int> dp(9); vector<pii> b = a; for (auto &p : b) { if (p.f > x) { p.f = 2; } else if (p.f == x) { p.f = 1; } else { p.f = 0; } if (p.s > y) { p.s = 2; } else if (p.s == y) { p.s = 1; } else { p.s = 0; } } dp[3 * b[0].f + b[0].s] = 1; for (int j = 1; j < n; ++j) { vector<int> dp2(9); for (int x = 0; x < 3; ++x) { for (int y = 0; y < 3; ++y) { if (!dp[x * 3 + y]) { continue; } dp2[max(x, b[j].f) * 3 + max(y, b[j].s)] = 1; dp2[min(x, b[j].f) * 3 + min(y, b[j].s)] = 1; } } dp = dp2; } if (dp[4]) { cout << i + 1 << ' '; } } cout << endl; } signed main() { #ifdef LOCAL freopen("in.txt", "r", stdin); freopen("out.txt", "w", stdout); #else ios::sync_with_stdio(false); cin.tie(0); #endif int t = 1; // cin >> t; while (t--) { solve(); } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...