Submission #18205616


Source Code Expand

Copy
#define _GLIBCXX_DEBUG
#include<atcoder/all>
#include<queue>
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++ (Clang 10.0.0)
Score 300
Code Size 499 Byte
Status AC
Exec Time 176 ms
Memory 4936 KB

Compile Error

In file included from ./Main.cpp:2:
In file included from /opt/ac-library/atcoder/all:6:
In file included from /opt/ac-library/atcoder/maxflow:1:
/opt/ac-library/atcoder/maxflow.hpp:38:13: warning: unused variable 'm' [-Wunused-variable]
        int m = int(pos.size());
            ^
/opt/ac-library/atcoder/maxflow.hpp:53:13: warning: unused variable 'm' [-Wunused-variable]
        int m = int(pos.size());
            ^
In file included from ./Main.cpp:2:
In file included from /opt/ac-library/atcoder/all:7:
In file included from /opt/ac-library/atcoder/mincostflow:1:
/opt/ac-library/atcoder/mincostflow.hpp:39:13: warning: unused variable 'm' [-Wunused-variable]
        int m = int(pos.size());
            ^
In file included from ./Main.cpp:2:
In file included from /opt/ac-library/atcoder/all:9:
In file included from /opt/ac-library/atcoder/scc:1:
/opt/ac-library/atcoder/scc.hpp:17:13: warning: unused variable 'n' [-Wunused-variable]
        int n = internal.num_vertices();
            ^
In file included from ./Main.cpp:2:
In file included from /opt/ac-library/atcoder/all:11:
In file included from /opt/ac-library/atcoder/string:1:
/opt/ac-library/atcoder/string.hpp:179:14: warning: unused variable 'd' [-Wunused-variable]
    for (int d : s) {
             ^
5 warnings generated.

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 300 / 300
Status
AC × 3
AC × 21
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 6 ms 3192 KB
sample_02.txt AC 11 ms 3200 KB
sample_03.txt AC 3 ms 3140 KB
subtask_1_1.txt AC 2 ms 3064 KB
subtask_1_10.txt AC 78 ms 3776 KB
subtask_1_11.txt AC 2 ms 3260 KB
subtask_1_12.txt AC 142 ms 4888 KB
subtask_1_13.txt AC 2 ms 3232 KB
subtask_1_14.txt AC 50 ms 3324 KB
subtask_1_15.txt AC 146 ms 4936 KB
subtask_1_16.txt AC 6 ms 3132 KB
subtask_1_17.txt AC 4 ms 3200 KB
subtask_1_18.txt AC 147 ms 4888 KB
subtask_1_2.txt AC 38 ms 3220 KB
subtask_1_3.txt AC 89 ms 3820 KB
subtask_1_4.txt AC 15 ms 3212 KB
subtask_1_5.txt AC 165 ms 4884 KB
subtask_1_6.txt AC 28 ms 3316 KB
subtask_1_7.txt AC 12 ms 3144 KB
subtask_1_8.txt AC 176 ms 4860 KB
subtask_1_9.txt AC 156 ms 4756 KB