結果
| 問題 |
No.789 範囲の合計
|
| コンテスト | |
| ユーザー |
horiesiniti
|
| 提出日時 | 2018-03-17 19:01:08 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 447 bytes |
| コンパイル時間 | 544 ms |
| コンパイル使用メモリ | 65,788 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-06-25 06:02:23 |
| 合計ジャッジ時間 | 2,313 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | WA * 15 |
ソースコード
#include <iostream>
#include <map>
using namespace std;
std::map<int,int> ms;
int main() {
// your code goes here
int x,n;
cin>>n;
long long int ans=0;
for(int i=0;i<n;i++){
cin>>x;
if(x==0){
int p1;
cin>>p1;
ms[p1]+=1;
}else{
int l,r;
cin>>l>>r;
std::map<int,int>::iterator it=ms.lower_bound(l);
while (it!=ms.end() && (*it).first<=r){
ans+=(*it).second;
it++;
}
}
}
cout<<ans<<"\n";
return 0;
}
horiesiniti