QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#358034 | #4894. 学姐买瓜 | zzafanti | 0 | 0ms | 3464kb | C++23 | 792b | 2024-03-19 16:34:00 | 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;
}
详细
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%