Submission #12896163


Source Code Expand

Copy
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
//#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
template<class T>bool chmax(T& a, const T& b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T& a, const T& b) { if (b < a) { a = b; return 1; } return 0; }
//---------------------------------------------------------------------------------------------------
/*---------------------------------------------------------------------------------------------------
            ∧_∧
      ∧_∧  (´<_` )  Welcome to My Coding Space!
     ( ´_ゝ`) /  ⌒i     @hamayanhamayan0
    /   \     | |
    /   / ̄ ̄ ̄ ̄/  |
  __(__ニつ/     _/ .| .|____
     \/____/ (u ⊃
---------------------------------------------------------------------------------------------------*/














int N, A[201010], B[201010];
vector<int> add[201010];
//---------------------------------------------------------------------------------------------------
void _main() {
	cin >> N;
	rep(i, 0, N) cin >> A[i] >> B[i];

	rep(i, 0, N) add[A[i]].push_back(B[i]);
	
	priority_queue<int> que;
	int ans = 0;
	rep(d, 1, N + 1) {
		fore(b, add[d]) que.push(b);
		ans += que.top();
		que.pop();
		printf("%d\n", ans);
	}
}





Submission Info

Submission Time
Task F - Tasking
User hamayanhamayan
Language C++ (GCC 9.2.1)
Score 7
Code Size 1718 Byte
Status AC
Exec Time 100 ms
Memory 16228 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 7 / 7
Status
AC × 3
AC × 14
Set Name Test Cases
Sample Sample_01.txt, Sample_02.txt, Sample_03.txt
All Sample_01.txt, Sample_02.txt, Sample_03.txt, amai_01.txt, amai_02.txt, iti_01.txt, large_01.txt, large_02.txt, large_03.txt, small_01.txt, small_02.txt, small_03.txt, strict_01.txt, strict_02.txt
Case Name Status Exec Time Memory
Sample_01.txt AC 8 ms 8292 KB
Sample_02.txt AC 7 ms 8384 KB
Sample_03.txt AC 6 ms 8396 KB
amai_01.txt AC 90 ms 13708 KB
amai_02.txt AC 86 ms 13696 KB
iti_01.txt AC 8 ms 8384 KB
large_01.txt AC 100 ms 14252 KB
large_02.txt AC 95 ms 14196 KB
large_03.txt AC 100 ms 14176 KB
small_01.txt AC 8 ms 8444 KB
small_02.txt AC 6 ms 8440 KB
small_03.txt AC 7 ms 8304 KB
strict_01.txt AC 84 ms 16124 KB
strict_02.txt AC 87 ms 16228 KB