Submission #445097

#TimeUsernameProblemLanguageResultExecution timeMemory
445097mosiashvililukaEvent Hopping 2 (JOI21_event2)C++14
1 / 100
92 ms3344 KiB
#include<bits/stdc++.h> /*#define a fskaddwq #define b fjsaijdsiajd #define c jfaisjad #define d jdisajdisajd #define e djsiajiwqhew #define i jisjadisja #define j dsjoajdisa #define ii djsiajwiqje #define jj djaskjdas #define zx jsajdisajd #define xc djsaaijdsiao #define k jdksajdkas #define P djsoajdas #define PI djsoajdosa #define qi jsiajdisa #define p osjaodjwo #define q djsiajdi #define v jdsodjaod*/ using namespace std; int a,b,c,d,e,i,j,ii,jj,zx,xc,k,P[100009],PI,qi; pair <int, int> p[100009],q[100009]; vector <int> v; vector <pair <int, int> > VA; vector <int> amoxsna20(int aa, int kk, vector <pair <int, int> > ppp){ a=aa;k=kk; for(i=0; i<a; i++){ p[i]=ppp[i]; } v.resize(k); v[0]=a+2; for(i=0; i<(1<<a); i++){ if(__builtin_popcount(i)!=k) continue; PI=0;qi=0; for(j=0; j<a; j++){ if((i&(1<<j))==0) continue; P[PI]=j;PI++; qi++;q[qi]=p[j]; } sort(q+1,q+qi+1); e=0; for(j=1; j<qi; j++){ if(q[j].second>q[j+1].first){ e=1; break; } } if(e==1) continue; e=0; for(j=0; j<PI; j++){ if(v[j]>P[j]){ e=1; break; } if(v[j]<P[j]){ break; } } if(e==0) continue; for(j=0; j<PI; j++){ v[j]=P[j]; } } if(v[0]==a+2){ for(j=0; j<k; j++){ v[j]=-1; } }else{ for(j=0; j<k; j++){ v[j]++; } } return v; } int main(){ cin>>a>>k; for(i=1; i<=a; i++){ cin>>p[i].first>>p[i].second; } for(i=1; i<=a; i++){ VA.push_back(p[i]); } v=amoxsna20(a,k,VA); if(v[0]==-1){ cout<<-1; return 0; } for(i=0; i<k; i++){ cout<<v[i]<<endl; } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...