Submission #71308338
Source Code Expand
#ifndef ONLINE_JUDGE
#define _GLIBCXX_DEBUG
#endif
#include <bits/stdc++.h>
#include <atcoder/all>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace atcoder;
using namespace __gnu_pbds;
using ll = long long; using mint=modint998244353; using ld = long double;
const ll infl = 1LL << 60;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const vector<int> dx = {1, 0, -1, 0}; const vector<int> dy = {0, 1, 0, -1};
template<typename T> using vc = vector<T>; template<typename T> using vvc = vc<vc<T>>; template<typename T> using vvvc = vc<vvc<T>>;
using vi = vc<int>; using vvi = vvc<int>; using vl = vc<ll>; using vvl = vvc<ll>; using vvvl = vvc<vl>; using vvvvl = vvc<vvl>;
using vs = vc<string>; using vvs = vvc<string>; using P = pair<ll, ll>;
#define nrep(i,n) for (ll i = 0; i < (n); ++i)
#define nfor(i,s,n) for(ll i=s;i<n;i++)//i=s,s+1...n-1 ノーマルfor
template<class T> using pq = priority_queue<T, vc<T>>;//★大きい順に取り出す コスト,頂点 bfs系で使う 小さい順じゃないですABC305E
template<class T> using pq_g = priority_queue<T, vc<T>, greater<T>>;//小さい順に取り出す ダイクストラ法で使う
// 単なるcout関数
template<typename T>
void print(const T& n) {
cout << n << "\n";
}
// デバッグ出力ユーティリティ
// 基本型(数値系)
template<typename T, typename = std::enable_if_t<std::is_arithmetic_v<T>>>
void debug_print(const T& v) { cout << v; }
// string
inline void debug_print(const std::string& s) { cout << s; }
inline void debug_print(const char* s) { cout << s; }
// pair
template<typename A, typename B>
void debug_print(const std::pair<A, B>& p) {
cout << "{";
debug_print(p.first);
cout << ", ";
debug_print(p.second);
cout << "}";
}
// queue
template<typename T, typename Cont>
void debug_print(const std::queue<T, Cont>& q) {
auto q2 = q;
cout << "queue[";
while (!q2.empty()) {
debug_print(q2.front());
q2.pop();
if (!q2.empty()) cout << ", ";
}
cout << "]";
}
// stack
template<typename T, typename Cont>
void debug_print(const std::stack<T, Cont>& s) {
auto s2 = s;
cout << "stack[";
std::vector<T> tmp;
while (!s2.empty()) {
tmp.push_back(s2.top());
s2.pop();
}
for (size_t i = 0; i < tmp.size(); ++i) {
debug_print(tmp[i]);
if (i + 1 != tmp.size()) cout << ", ";
}
cout << "]";
}
// priority_queue
template<typename T, typename Cont, typename Comp>
void debug_print(const std::priority_queue<T, Cont, Comp>& pq) {
auto q2 = pq;
cout << "priority_queue[";
std::vector<T> tmp;
while (!q2.empty()) {
tmp.push_back(q2.top());
q2.pop();
}
for (size_t i = 0; i < tmp.size(); ++i) {
debug_print(tmp[i]);
if (i + 1 != tmp.size()) cout << ", ";
}
cout << "]";
}
// イテレータを持つコンテナ(string, queue, stack, priority_queue 以外)
template<typename T>
auto debug_print(const T& c) -> decltype(std::begin(c), void()) {
cout << "[";
auto it = std::begin(c);
while (it != std::end(c)) {
debug_print(*it);
if (++it != std::end(c)) cout << ", ";
}
cout << "]";
}
// デバッグ用のマクロ(変数名と値を一緒に出力)
#ifndef ONLINE_JUDGE
#define DEBUG(...) cerr << #__VA_ARGS__ << " = "; debug_print(__VA_ARGS__); cerr << endl;
#else
#define DEBUG(...)
#endif
// 1次元vector出力関数
template<typename T>
void vc_cout(const vector<T>& v) {
for (size_t i = 0; i < v.size(); ++i) {
cout << v[i];
if (i + 1 != v.size()) cout << " ";
}
cout << "\n";
}
// 2次元vector出力関数
template<typename T>
void vv_cout(const vector<vector<T>>& v) {
for (size_t i = 0; i < v.size(); ++i) {
for (size_t j = 0; j < v[i].size(); ++j) {
cout << v[i][j];
if (j + 1 != v[i].size()) cout << " ";
}
cout << "\n";
}
}
// `vector<string>` 用のオーバーロード: 各文字列をそのまま1行で出力する
void vv_cout(const vector<string>& v) {
for (const auto& s : v) cout << s << "\n";
}
/*
********************************************************** ここまでテンプレ **********************************************************
*/
ll N, M;
int main() {
cin.tie(nullptr);
ios_base::sync_with_stdio(false);
cin >> N >> M;
vc<P> ans(M, {0, 0});
nrep(i, N){
ll a, b;
cin >> a >> b;
a--;
auto [c, d] = ans[a];
ans[a] = {c+b, d+1};
}
nrep(i, M) {
auto [c, d] = ans[i];
cout << setprecision(15) << (ld)c / (ld)d << endl;
}
}
Submission Info
| Submission Time |
|
| Task |
B - Bird Watching |
| User |
kuruma_zensoku |
| Language |
C++23 (GCC 15.2.0) |
| Score |
200 |
| Code Size |
5026 Byte |
| Status |
AC |
| Exec Time |
1 ms |
| Memory |
3920 KiB |
Judge Result
| Set Name |
Sample |
All |
| Score / Max Score |
0 / 0 |
200 / 200 |
| Status |
|
|
| Set Name |
Test Cases |
| Sample |
sample_01.txt |
| All |
sample_01.txt, test_01.txt, test_02.txt, test_03.txt, test_04.txt, test_05.txt, test_06.txt, test_07.txt, test_08.txt, test_09.txt, test_10.txt, test_11.txt, test_12.txt, test_13.txt, test_14.txt, test_15.txt, test_16.txt, test_17.txt, test_18.txt, test_19.txt, test_20.txt, test_21.txt, test_22.txt, test_23.txt |
| Case Name |
Status |
Exec Time |
Memory |
| sample_01.txt |
AC |
1 ms |
3876 KiB |
| test_01.txt |
AC |
1 ms |
3896 KiB |
| test_02.txt |
AC |
1 ms |
3900 KiB |
| test_03.txt |
AC |
1 ms |
3900 KiB |
| test_04.txt |
AC |
1 ms |
3880 KiB |
| test_05.txt |
AC |
1 ms |
3828 KiB |
| test_06.txt |
AC |
1 ms |
3900 KiB |
| test_07.txt |
AC |
1 ms |
3808 KiB |
| test_08.txt |
AC |
1 ms |
3912 KiB |
| test_09.txt |
AC |
1 ms |
3772 KiB |
| test_10.txt |
AC |
1 ms |
3876 KiB |
| test_11.txt |
AC |
1 ms |
3808 KiB |
| test_12.txt |
AC |
1 ms |
3912 KiB |
| test_13.txt |
AC |
1 ms |
3828 KiB |
| test_14.txt |
AC |
1 ms |
3844 KiB |
| test_15.txt |
AC |
1 ms |
3708 KiB |
| test_16.txt |
AC |
1 ms |
3816 KiB |
| test_17.txt |
AC |
1 ms |
3920 KiB |
| test_18.txt |
AC |
1 ms |
3888 KiB |
| test_19.txt |
AC |
1 ms |
3844 KiB |
| test_20.txt |
AC |
1 ms |
3912 KiB |
| test_21.txt |
AC |
1 ms |
3828 KiB |
| test_22.txt |
AC |
1 ms |
3880 KiB |
| test_23.txt |
AC |
1 ms |
3772 KiB |