Submission #413640

#TimeUsernameProblemLanguageResultExecution timeMemory
413640vato_chachanidzeEvent Hopping 2 (JOI21_event2)C++14
0 / 100
89 ms2896 KiB
#include<bits/stdc++.h> using namespace std; long long n,k,i,finish,r[100009],l[100009],q; vector<long long> ans; int main() { cin>>n>>k; for(i=1;i<=n;i++) { cin>>r[i]>>l[i]; } finish=l[1]; q=1; ans.push_back(1); for(i=2;i<=n;i++) { if(q==k) { break; } if(finish>r[i]) { continue; } finish=l[i]; q++; ans.push_back(i); } if(q!=k) { cout<<"-1"<<endl; } else { for(i=0;i<ans.size();i++) { cout<<ans[i]<<endl; } } }

Compilation message (stderr)

event2.cpp: In function 'int main()':
event2.cpp:38:12: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   38 |   for(i=0;i<ans.size();i++)
      |           ~^~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...