Submission #159066


Source Code Expand

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

using namespace std;

typedef pair<int, int> PII;
#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)
#define SORT(c) sort((c).begin(),(c).end())

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

    vector<PII> ad;
    REP(i, n) {
        int a, b;
        cin >> a >> b;
        ad.push_back(PII(a, b));
    }
    SORT(ad);

    int ans = 0;

    REP(i, k) {
        ans += ad[0].first;
        ad[0].first += ad[0].second;
        SORT(ad);
    }

    cout << ans << endl;
}

Submission Info

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

Test Cases

Set Name Score / Max Score Test Cases
Sample 0 / 0 subtask0_sample-01.txt, subtask0_sample-02.txt
Subtask1 30 / 30 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 0 / 10 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 0 / 15 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 0 / 45 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 928 KB
subtask0_sample-02.txt 21 ms 808 KB
subtask1_01.txt 20 ms 800 KB
subtask1_02.txt 21 ms 804 KB
subtask1_03.txt 20 ms 916 KB
subtask1_04.txt 21 ms 804 KB
subtask1_05.txt 22 ms 800 KB
subtask1_06.txt 44 ms 932 KB
subtask1_07.txt 21 ms 800 KB
subtask1_08.txt 23 ms 808 KB
subtask1_09.txt 22 ms 932 KB
subtask1_10.txt 25 ms 924 KB
subtask1_11.txt 24 ms 924 KB
subtask1_12.txt 21 ms 920 KB
subtask2_01.txt 21 ms 804 KB
subtask2_02.txt 36 ms 792 KB
subtask2_03.txt 48 ms 800 KB
subtask2_04.txt 24 ms 928 KB
subtask2_05.txt 61 ms 808 KB
subtask2_06.txt 897 ms 928 KB
subtask2_07.txt 898 ms 784 KB
subtask2_08.txt 718 ms 752 KB
subtask2_09.txt 1167 ms 932 KB
subtask2_10.txt 1697 ms 928 KB
subtask2_11.txt 1656 ms 924 KB
subtask2_12.txt 1066 ms 920 KB
subtask3_01.txt 27 ms 928 KB
subtask3_02.txt 22 ms 932 KB
subtask3_03.txt 871 ms 924 KB
subtask3_04.txt 1994 ms 1952 KB
subtask3_05.txt 45 ms 796 KB
subtask3_06.txt 2028 ms 928 KB
subtask3_07.txt 2029 ms 1188 KB
subtask3_08.txt 2029 ms 1952 KB
subtask3_09.txt 2029 ms 1948 KB
subtask3_10.txt 2029 ms 1952 KB
subtask3_11.txt 2030 ms 1952 KB
subtask3_12.txt 2029 ms 1448 KB
subtask4_01.txt 2029 ms 1944 KB
subtask4_02.txt 2029 ms 808 KB
subtask4_03.txt 2029 ms 936 KB
subtask4_04.txt 2030 ms 1944 KB
subtask4_05.txt 2029 ms 936 KB
subtask4_06.txt 650 ms 808 KB
subtask4_07.txt 1211 ms 800 KB
subtask4_08.txt 100 ms 808 KB
subtask4_09.txt 2030 ms 1960 KB
subtask4_10.txt 2029 ms 812 KB
subtask4_11.txt 2029 ms 1948 KB
subtask4_12.txt 2028 ms 1952 KB
subtask4_13.txt 2030 ms 1960 KB
subtask4_14.txt 1208 ms 776 KB