Submission #18205604


Source Code Expand

Copy
#define _GLIBCXX_DEBUG
#include<atcoder/all>
#include<bits/stdc++.h>
using namespace std;
using namespace atcoder;
using mint = modint1000000007;
#define rep(i,n) for(int i=0;i<(n);i++)


int main() {
  int N,K;cin>>N>>K;
  priority_queue<pair<long, long>> Q;
  rep(i,N) {
    int a,b;cin>>a>>b;Q.push(make_pair(-a,b));
  }
  long sum=0;
  rep(i,K) {
    auto top = Q.top(); Q.pop();
    sum+=-top.first;
    Q.push(make_pair(top.first-top.second,top.second));
  }
  cout<<sum<<endl;
}

Submission Info

Submission Time
Task C - Factory
User kanjino
Language C++ (GCC 9.2.1)
Score 0
Code Size 507 Byte
Status TLE
Exec Time 2205 ms
Memory 3680 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 300
Status
AC × 3
AC × 9
TLE × 12
Set Name Test Cases
Sample sample_01.txt, sample_02.txt, sample_03.txt
All sample_01.txt, sample_02.txt, sample_03.txt, subtask_1_1.txt, subtask_1_10.txt, subtask_1_11.txt, subtask_1_12.txt, subtask_1_13.txt, subtask_1_14.txt, subtask_1_15.txt, subtask_1_16.txt, subtask_1_17.txt, subtask_1_18.txt, subtask_1_2.txt, subtask_1_3.txt, subtask_1_4.txt, subtask_1_5.txt, subtask_1_6.txt, subtask_1_7.txt, subtask_1_8.txt, subtask_1_9.txt
Case Name Status Exec Time Memory
sample_01.txt AC 7 ms 3564 KB
sample_02.txt AC 271 ms 3664 KB
sample_03.txt AC 93 ms 3552 KB
subtask_1_1.txt AC 12 ms 3576 KB
subtask_1_10.txt TLE 2205 ms 3604 KB
subtask_1_11.txt AC 8 ms 3500 KB
subtask_1_12.txt TLE 2205 ms 3604 KB
subtask_1_13.txt AC 9 ms 3580 KB
subtask_1_14.txt TLE 2205 ms 3564 KB
subtask_1_15.txt TLE 2205 ms 3528 KB
subtask_1_16.txt AC 127 ms 3468 KB
subtask_1_17.txt AC 95 ms 3552 KB
subtask_1_18.txt TLE 2205 ms 3680 KB
subtask_1_2.txt TLE 2205 ms 3536 KB
subtask_1_3.txt TLE 2205 ms 3520 KB
subtask_1_4.txt TLE 2205 ms 3408 KB
subtask_1_5.txt TLE 2205 ms 3508 KB
subtask_1_6.txt TLE 2205 ms 3452 KB
subtask_1_7.txt AC 961 ms 3604 KB
subtask_1_8.txt TLE 2205 ms 3580 KB
subtask_1_9.txt TLE 2205 ms 3600 KB