結果
| 問題 |
No.789 範囲の合計
|
| コンテスト | |
| ユーザー |
emthrm
|
| 提出日時 | 2019-02-08 22:29:38 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 1,356 bytes |
| コンパイル時間 | 1,090 ms |
| コンパイル使用メモリ | 123,476 KB |
| 最終ジャッジ日時 | 2025-01-06 21:01:29 |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 5 TLE * 10 |
ソースコード
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <chrono>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <string>
#include <tuple>
#include <unordered_map>
#include <vector>
using namespace std;
#define FOR(i,m,n) for(int i=(m);i<(n);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
const int INF = 0x3f3f3f3f;
const long long LINF = 0x3f3f3f3f3f3f3f3fLL;
/*----------------------------------------*/
int main() {
cin.tie(0); ios::sync_with_stdio(false);
// freopen("input.txt", "r", stdin);
int n; cin >> n;
vector<bool> docchi(n, false); // true -> query
vector<pair<int, int>> ar, query;
REP(i, n) {
int q, x, y; cin >> q >> x >> y;
if (q == 0) ar.push_back({x, y});
else {
docchi[i] = true;
query.push_back({x, y});
}
}
int a = 0, q = 0, sz = query.size();
long long ans = 0;
REP(i, n) {
if (docchi[i] == 0) {
FOR(j, q, sz) {
if (query[j].first <= ar[a].first && ar[a].first <= query[j].second) ans += ar[a].second;
}
++a;
} else ++q;
}
cout << ans << '\n';
return 0;
}
emthrm