Submission #756786

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
7567862023-06-12 07:51:09Dan4LifeEvent Hopping 2 (JOI21_event2)C++17
100 / 100
243 ms20084 KiB
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define all(a) begin(a),end(a)
const int N = (int)2e5+5, Lg = 17;
int n, k;
vector<int> v;
set<pair<int,int>> S;
int L[N], R[N], J[Lg][N*2];
int get(int l, int r){
int T = 0;
for(int i = Lg-1; i>=0; i--)
if(J[i][l]<=r) l=J[i][l], T+=(1<<i);
return T;
}
int main(){
cin >> n >> k;
for(int i = 1; i <= n; i++)
cin >> L[i] >> R[i], v.pb(L[i]), v.pb(R[i]);
sort(all(v)); v.erase(unique(all(v)),end(v));
int m = v.size();
for(int i = 0; i <= m; i++) J[0][i]=m;
for(int i = 1; i <= n; i++){
L[i] = lower_bound(all(v),L[i])-begin(v);
R[i] = lower_bound(all(v),R[i])-begin(v);
J[0][L[i]] = min(J[0][L[i]],R[i]);
}
for(int i = m-1; i>=0; i--)
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Compilation message (stderr)

event2.cpp: In function 'int main()':
event2.cpp:44:24: warning: comparison of integer expressions of different signedness: 'std::set<std::pair<int, int> >::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   44 |             if(S.size()==k+2) break;
      |                ~~~~~~~~^~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...