Submission #1006220

#TimeUsernameProblemLanguageResultExecution timeMemory
1006220DangerNoodle7591Osumnjičeni (COCI21_osumnjiceni)C++17
0 / 110
1006 ms11356 KiB
#include <bits/stdc++.h> using namespace std; #define lalala ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL); #define endl '\n' //#define int long long int //#define ll long long #define pb push_back #define p push #define f first #define s second #define N 5000 vector<tuple<int,int,int>> v; int cevap(int l,int r){ int cev=0; multiset<int> st; for(int i=0;i<v.size();i++){ int a,b,c;tie(a,b,c)=v[i]; if(c<l||c>r)continue; auto it=st.upper_bound(-b); if(it==st.end()){ st.insert(-a); continue; } st.erase(it); st.insert(-a); } return (int)st.size(); } signed main(){ lalala; int n;cin>>n; for(int i=0;i<n;i++){ int a,b;cin>>a>>b; v.pb({b,a,i+1}); } sort(v.begin(),v.end()); int q;cin>>q; while(q--){ int l,r;cin>>l>>r; cout<<cevap(l,r)<<endl; } }

Compilation message (stderr)

Main.cpp: In function 'int cevap(int, int)':
Main.cpp:18:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::tuple<int, int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   18 |   for(int i=0;i<v.size();i++){
      |               ~^~~~~~~~~
Main.cpp:16:7: warning: unused variable 'cev' [-Wunused-variable]
   16 |   int cev=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...
#Verdict Execution timeMemoryGrader output
Fetching results...