結果
問題 | No.2154 あさかつの参加人数 |
ユーザー | ZOI-dayo |
提出日時 | 2023-10-18 15:35:40 |
言語 | C++23 (gcc 12.3.0 + boost 1.83.0) |
結果 |
AC
|
実行時間 | 1,002 ms / 2,000 ms |
コード長 | 5,706 bytes |
コンパイル時間 | 2,997 ms |
コンパイル使用メモリ | 246,916 KB |
実行使用メモリ | 11,136 KB |
最終ジャッジ日時 | 2024-09-18 11:45:23 |
合計ジャッジ時間 | 26,364 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 988 ms
11,008 KB |
testcase_01 | AC | 987 ms
11,008 KB |
testcase_02 | AC | 987 ms
11,008 KB |
testcase_03 | AC | 982 ms
11,136 KB |
testcase_04 | AC | 1,002 ms
11,008 KB |
testcase_05 | AC | 171 ms
5,376 KB |
testcase_06 | AC | 553 ms
6,400 KB |
testcase_07 | AC | 566 ms
8,192 KB |
testcase_08 | AC | 606 ms
8,980 KB |
testcase_09 | AC | 354 ms
7,296 KB |
testcase_10 | AC | 503 ms
7,680 KB |
testcase_11 | AC | 874 ms
10,136 KB |
testcase_12 | AC | 599 ms
7,752 KB |
testcase_13 | AC | 280 ms
5,376 KB |
testcase_14 | AC | 608 ms
7,552 KB |
testcase_15 | AC | 576 ms
8,576 KB |
testcase_16 | AC | 668 ms
8,372 KB |
testcase_17 | AC | 643 ms
7,424 KB |
testcase_18 | AC | 764 ms
8,820 KB |
testcase_19 | AC | 82 ms
5,376 KB |
testcase_20 | AC | 707 ms
9,088 KB |
testcase_21 | AC | 318 ms
6,912 KB |
testcase_22 | AC | 621 ms
10,496 KB |
testcase_23 | AC | 752 ms
9,088 KB |
testcase_24 | AC | 870 ms
9,984 KB |
ソースコード
#line 1 "test/yukicoder/2154__imos.test.cpp" #define PROBLEM "https://yukicoder.me/problems/no/2154" #line 2 "datastructure/imos.hpp" #line 2 "common/alias.hpp" #include <bits/stdc++.h> // #include <gmpxx.h> // #include <boost/multiprecision/cpp_int.hpp> #line 2 "common/print.hpp" #line 4 "common/print.hpp" using namespace std; // --------------- // ----- TOC ----- template <typename T1, typename T2> ostream &operator<<(ostream &os, const pair<T1, T2> &p); template <typename T1, typename T2> istream &operator>>(istream &is, pair<T1, T2> &p); template <typename T> ostream &operator<<(ostream &os, const vector<T> &v); template <typename T> ostream &operator<<(ostream &os, const vector<vector<T>> &v); template <typename T> ostream &operator<<(ostream &os, const vector<vector<vector<T>>> &v); template <typename T> istream &operator>>(istream &is, vector<T> &v); template <typename T, typename S> ostream &operator<<(ostream &os, const map<T, S> &mp); template <typename T> ostream &operator<<(ostream &os, const set<T> &st); template <typename T> ostream &operator<<(ostream &os, const multiset<T> &st); template <typename T> ostream &operator<<(ostream &os, queue<T> q); template <typename T> ostream &operator<<(ostream &os, deque<T> q); template <typename T> ostream &operator<<(ostream &os, stack<T> st); template <class T, class Container, class Compare> ostream &operator<<(ostream &os, priority_queue<T, Container, Compare> pq); // --- END TOC --- // --------------- template <typename T1, typename T2> ostream &operator<<(ostream &os, const pair<T1, T2> &p) { os << "(" << p.first << "," << p.second << ")"; return os; } template <typename T1, typename T2> istream &operator>>(istream &is, pair<T1, T2> &p) { is >> p.first >> p.second; return is; } template <typename T> ostream &operator<<(ostream &os, const vector<T> &v) { os << "["; for (int i = 0; i < (int)v.size(); i++) { os << v[i] << (i + 1 != (int)v.size() ? ", " : "]"); } return os; } template <typename T> ostream &operator<<(ostream &os, const vector<vector<T>> &v) { for (int i = 0; i < (int)v.size(); i++) { os << v[i] << endl; } return os; } template <typename T> ostream &operator<<(ostream &os, const vector<vector<vector<T>>> &v) { for (int i = 0; i < (int)v.size(); i++) { os << "i = " << i << endl; os << v[i]; } return os; } template <typename T> istream &operator>>(istream &is, vector<T> &v) { for (T &in : v) is >> in; return is; } template <typename T, typename S> ostream &operator<<(ostream &os, const map<T, S> &mp) { for (auto &[key, val] : mp) { os << key << ":" << val << " "; } return os; } template <typename T> ostream &operator<<(ostream &os, const set<T> &st) { os << "{"; auto itr = st.begin(); for (int i = 0; i < (int)st.size(); i++) { os << *itr << (i + 1 != (int)st.size() ? ", " : "}"); itr++; } return os; } template <typename T> ostream &operator<<(ostream &os, const multiset<T> &st) { auto itr = st.begin(); for (int i = 0; i < (int)st.size(); i++) { os << *itr << (i + 1 != (int)st.size() ? " " : ""); itr++; } return os; } template <typename T> ostream &operator<<(ostream &os, queue<T> q) { while (q.size()) { os << q.front() << " "; q.pop(); } return os; } template <typename T> ostream &operator<<(ostream &os, deque<T> q) { while (q.size()) { os << q.front() << " "; q.pop_front(); } return os; } template <typename T> ostream &operator<<(ostream &os, stack<T> st) { while (st.size()) { os << st.top() << " "; st.pop(); } return os; } template <class T, class Container, class Compare> ostream &operator<<(ostream &os, priority_queue<T, Container, Compare> pq) { while (pq.size()) { os << pq.top() << " "; pq.pop(); } return os; } #line 8 "common/alias.hpp" using namespace std; // using namespace boost::multiprecision; // --- 型エイリアス --- using ll = long long; template <typename T> using vec = vector<T>; template <typename T> using vvec = vector<vector<T>>; template <typename T> using p_queue = priority_queue<T>; template <typename T> using rp_queue = priority_queue<T, vec<T>, greater<T>>; // --- 黒魔術 --- #define int ll // --- 制御マクロ --- #define rep(i, n) for (ll i = 0; i < n; ++i) #define all(v) begin(v), end(v) #define BIT(n) (1LL << (n)) #define MAX(type) numeric_limits<type>::max() #define MIN(type) numeric_limits<type>::min() #define yes cout << "Yes" << endl #define no cout << "No" << endl #define pb push_back #define mp make_pair #define fir first #define sec second // --- 定数 --- constexpr ll INF = 1LL << 60; #line 4 "datastructure/imos.hpp" template<typename T> struct imos{ private: int _n; vec<T> _data, _raw; bool _is_build = false; public: imos(int n) : _n(n), _data(_n+1, 0), _raw(_n, 0) {} imos(vec<T> src) : _n(src.size()), _data(_n+1, 0), _raw(_n, 0) { rep(i, _n) add(i, src[i]); } inline void add(int l, int r, T x) { assert(l < r); assert(0 <= l && r <= _n); _is_build = false; _data[l] += x; _data[r] -= x; } inline void add(int i, T x) { assert(0 <= i && i < _n); _is_build = false; add(i, i+1, x); } inline void build() { _raw[0] = _data[0]; for(int i=1; i<_n; i++) _raw[i] = _raw[i-1] + _data[i]; _is_build = true; } inline T get(int i) { assert(0 <= i && i < _n); if (!_is_build) build(); return _raw[i]; } }; #line 4 "test/yukicoder/2154__imos.test.cpp" signed main() { int N, M; cin >> N >> M; imos<ll> imos(N); rep(i, M) { int l, r; cin >> l >> r; imos.add(N-l, N-r+1, 1); } rep(i, N) { cout << imos.get(i) << endl; } }