QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#358034#4894. 学姐买瓜zzafanti0 0ms3464kbC++23792b2024-03-19 16:34:002024-03-19 16:34:00

Judging History

你现在查看的是最新测评结果

  • [2024-03-19 16:34:00]
  • 评测
  • 测评结果:0
  • 用时:0ms
  • 内存:3464kb
  • [2024-03-19 16:34:00]
  • 提交

answer

#include<bits/stdc++.h>

using namespace std;
using E=long long;

int main(){

#ifdef zzafanti
  freopen("in.in","r",stdin);
#endif // zzafanti

  cin.tie(nullptr),cout.tie(nullptr)->sync_with_stdio(false);

  int n,m;
  cin>>n>>m;

  vector<pair<int,int>> p;

  while(m--){
    int op,l,r;
    cin>>op>>l>>r;
    if(op==1){
      p.emplace_back(make_pair(l,r));
      continue;
    }
    vector<pair<int,int>> T;
    for(auto pt:p){
      if(pt.first>=l&&pt.second<=r) T.emplace_back(pt);
    }
    sort(T.begin(),T.end(),[&](pair<int,int> &x,pair<int,int> &y){ return x.second<y.second; });
    int cnt=0,mxx=0;
    for(auto pt:T){
      if(pt.first>mxx){
        cnt++;
        mxx=pt.second;
      }
    }
    cout<<cnt<<'\n';
  }

  return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 0
Wrong Answer

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 3464kb

input:

11 13
2 4 4
1 11 12
1 1 5
1 2 3
1 2 10
2 2 8
1 6 6
2 2 10
1 6 11
2 2 3
2 2 13

output:

0
1
2
1
3
3
3

result:

wrong output format Extra information in the output file

Subtask #2:

score: 0
Skipped

Dependency #1:

0%

Subtask #3:

score: 0
Skipped

Dependency #2:

0%