Submission #1207504

#TimeUsernameProblemLanguageResultExecution timeMemory
1207504lightonCard Collection (JOI24_collection)C++20
11 / 100
4097 ms16268 KiB
#include<bits/stdc++.h> #define pb push_back #define all(v) v.begin(),v.end() #define forf(i,s,e) for(int i = s; i<=e; i++) #define forb(i,s,e) for(int i = s; i>=e; i--) #define idx(i,v) lower_bound(all(v),i)-v.begin() #define comp(v) v.erase(unique(all(v)),v.end()) #define sz(v) (int)v.size() #define fs first #define se second #define SP << " " << #define LN << "\n" #define IO cin.tie(0);cout.tie(0);ios_base::sync_with_stdio(false); using namespace std; typedef long long ll; ll inf = 1e18; int N,M; bool dp[2001][2001][3][3]; int A[100001], B[100001]; int cmp(int a, int b){ if(a<b) return 0; if(a==b) return 1; return 2; } int main(){ cin>>N>>M; forf(i,1,N) cin>>A[i]>>B[i]; forf(q,1,M){ int X,Y; cin>>X>>Y; forf(s,1,N) forf(e,s,N) forf(i,0,2) forf(j,0,2) dp[s][e][i][j] = false; forf(l,1,N) forf(s,1,N){ int e= s+l-1; if(e>N) continue; if(l==1) dp[s][e][cmp(A[s],X)][cmp(B[s],Y)] = true; else{ forf(k,s,e-1){ forf(si,0,2) forf(sj,0,2) forf(i,0,2) forf(j,0,2){ if(dp[k+1][e][i][j] && dp[s][k][si][sj]) dp[s][e][max(i,si)][max(j,sj)] = true, dp[s][e][min(i,si)][min(j,sj)] = true; } } } } if(dp[1][N][1][1]) cout<<q<<"\n"; } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...