답안 #1006220

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1006220 2024-06-23T14:43:53 Z DangerNoodle7591 Osumnjičeni (COCI21_osumnjiceni) C++17
0 / 110
1000 ms 11356 KB
#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

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;
      |       ^~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 75 ms 10688 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 796 ms 752 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 796 ms 752 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1006 ms 11356 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 75 ms 10688 KB Output isn't correct
2 Halted 0 ms 0 KB -