Submission #159196


Source Code Expand

Copy
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

typedef long long LL;
typedef pair<LL, LL> PLL;
#define REP(i,n) for(int i = 0; i < (int)(n); ++i)
#define FOR(i,a,b) for(int i = (a); i < (int)(b); ++i)

int main()
{
    int k, n;
    cin >> k >> n;

    vector<PLL> ad;
    REP(i, n) {
        int a, b;
        cin >> a >> b;
        ad.push_back(PLL(a, b));
    }
    partial_sort(ad.begin(), ad.begin() + 1, ad.end());

    LL ans = 0;

    REP(i, k) {
        ans += ad[0].first;
        ad[0].first += ad[0].second;
        partial_sort(ad.begin(), ad.begin() + 1, ad.end());
    }

    cout << ans << endl;
}

Submission Info

Submission Time
Task C - 増築王高橋君
User awaki75
Language C++ (G++ 4.6.4)
Score 40
Code Size 681 Byte
Status
Exec Time 2030 ms
Memory 2976 KB

Judge Result

Set Name Sample Subtask1 Subtask2 Subtask3 Subtask4
Score / Max Score 0 / 0 30 / 30 10 / 10 0 / 15 0 / 45
Status
× 2
× 14
× 26
× 32
× 6
× 36
× 16
Set Name Test Cases
Sample subtask0_sample-01.txt, subtask0_sample-02.txt
Subtask1 subtask0_sample-01.txt, subtask0_sample-02.txt, subtask1_01.txt, subtask1_02.txt, subtask1_03.txt, subtask1_04.txt, subtask1_05.txt, subtask1_06.txt, subtask1_07.txt, subtask1_08.txt, subtask1_09.txt, subtask1_10.txt, subtask1_11.txt, subtask1_12.txt
Subtask2 subtask0_sample-01.txt, subtask0_sample-02.txt, subtask1_01.txt, subtask1_02.txt, subtask1_03.txt, subtask1_04.txt, subtask1_05.txt, subtask1_06.txt, subtask1_07.txt, subtask1_08.txt, subtask1_09.txt, subtask1_10.txt, subtask1_11.txt, subtask1_12.txt, subtask2_01.txt, subtask2_02.txt, subtask2_03.txt, subtask2_04.txt, subtask2_05.txt, subtask2_06.txt, subtask2_07.txt, subtask2_08.txt, subtask2_09.txt, subtask2_10.txt, subtask2_11.txt, subtask2_12.txt
Subtask3 subtask0_sample-01.txt, subtask0_sample-02.txt, subtask1_01.txt, subtask1_02.txt, subtask1_03.txt, subtask1_04.txt, subtask1_05.txt, subtask1_06.txt, subtask1_07.txt, subtask1_08.txt, subtask1_09.txt, subtask1_10.txt, subtask1_11.txt, subtask1_12.txt, subtask2_01.txt, subtask2_02.txt, subtask2_03.txt, subtask2_04.txt, subtask2_05.txt, subtask2_06.txt, subtask2_07.txt, subtask2_08.txt, subtask2_09.txt, subtask2_10.txt, subtask2_11.txt, subtask2_12.txt, subtask3_01.txt, subtask3_02.txt, subtask3_03.txt, subtask3_04.txt, subtask3_05.txt, subtask3_06.txt, subtask3_07.txt, subtask3_08.txt, subtask3_09.txt, subtask3_10.txt, subtask3_11.txt, subtask3_12.txt
Subtask4 subtask0_sample-01.txt, subtask0_sample-02.txt, subtask1_01.txt, subtask1_02.txt, subtask1_03.txt, subtask1_04.txt, subtask1_05.txt, subtask1_06.txt, subtask1_07.txt, subtask1_08.txt, subtask1_09.txt, subtask1_10.txt, subtask1_11.txt, subtask1_12.txt, subtask2_01.txt, subtask2_02.txt, subtask2_03.txt, subtask2_04.txt, subtask2_05.txt, subtask2_06.txt, subtask2_07.txt, subtask2_08.txt, subtask2_09.txt, subtask2_10.txt, subtask2_11.txt, subtask2_12.txt, subtask3_01.txt, subtask3_02.txt, subtask3_03.txt, subtask3_04.txt, subtask3_05.txt, subtask3_06.txt, subtask3_07.txt, subtask3_08.txt, subtask3_09.txt, subtask3_10.txt, subtask3_11.txt, subtask3_12.txt, subtask4_01.txt, subtask4_02.txt, subtask4_03.txt, subtask4_04.txt, subtask4_05.txt, subtask4_06.txt, subtask4_07.txt, subtask4_08.txt, subtask4_09.txt, subtask4_10.txt, subtask4_11.txt, subtask4_12.txt, subtask4_13.txt, subtask4_14.txt
Case Name Status Exec Time Memory
subtask0_sample-01.txt 21 ms 916 KB
subtask0_sample-02.txt 21 ms 932 KB
subtask1_01.txt 21 ms 804 KB
subtask1_02.txt 21 ms 796 KB
subtask1_03.txt 23 ms 800 KB
subtask1_04.txt 21 ms 924 KB
subtask1_05.txt 23 ms 800 KB
subtask1_06.txt 20 ms 792 KB
subtask1_07.txt 22 ms 928 KB
subtask1_08.txt 22 ms 928 KB
subtask1_09.txt 22 ms 928 KB
subtask1_10.txt 20 ms 924 KB
subtask1_11.txt 20 ms 800 KB
subtask1_12.txt 21 ms 800 KB
subtask2_01.txt 21 ms 800 KB
subtask2_02.txt 21 ms 928 KB
subtask2_03.txt 24 ms 924 KB
subtask2_04.txt 22 ms 920 KB
subtask2_05.txt 25 ms 800 KB
subtask2_06.txt 83 ms 928 KB
subtask2_07.txt 96 ms 924 KB
subtask2_08.txt 84 ms 800 KB
subtask2_09.txt 115 ms 928 KB
subtask2_10.txt 153 ms 1048 KB
subtask2_11.txt 146 ms 936 KB
subtask2_12.txt 58 ms 928 KB
subtask3_01.txt 22 ms 924 KB
subtask3_02.txt 26 ms 800 KB
subtask3_03.txt 93 ms 920 KB
subtask3_04.txt 128 ms 2968 KB
subtask3_05.txt 25 ms 936 KB
subtask3_06.txt 1404 ms 924 KB
subtask3_07.txt 2028 ms 1436 KB
subtask3_08.txt 2029 ms 2908 KB
subtask3_09.txt 2030 ms 2972 KB
subtask3_10.txt 2030 ms 2964 KB
subtask3_11.txt 2029 ms 2968 KB
subtask3_12.txt 2029 ms 1944 KB
subtask4_01.txt 2029 ms 2904 KB
subtask4_02.txt 2030 ms 892 KB
subtask4_03.txt 2029 ms 932 KB
subtask4_04.txt 2028 ms 2968 KB
subtask4_05.txt 2028 ms 852 KB
subtask4_06.txt 220 ms 804 KB
subtask4_07.txt 679 ms 804 KB
subtask4_08.txt 67 ms 812 KB
subtask4_09.txt 2029 ms 2964 KB
subtask4_10.txt 2029 ms 884 KB
subtask4_11.txt 2029 ms 2976 KB
subtask4_12.txt 2029 ms 2968 KB
subtask4_13.txt 2029 ms 2964 KB
subtask4_14.txt 679 ms 804 KB