Submission #2554796


Source Code Expand

#include <stdio.h>
#include <vector>
#include <algorithm>
#include <utility>
using namespace std;

bool comp(const pair<int,int> a, const pair<int,int> b) {
    return a.second * b.first > a.first * b.second;
}

int main(void){
    int n,d,x;
    scanf("%d %d %d",&n,&d,&x);
    int p[d][n];
    for(int i=0;i<d;i++)for(int j=0;j<n;j++)scanf("%d",&p[i][j]);
    for(int i=1;i<d;i++){
        vector<pair<int,int> > unko;
        for(int j=0;j<n;j++)unko.push_back(make_pair(p[i-1][j],p[i][j]));
        
        int yamada[114514];
        for(int j=0;j<114514;j++)yamada[j]=j;
        for(int j=0;j<n;j++)for(int k=0;k<114514;k++){
            if(k+unko[j].first<114514&&yamada[k+unko[j].first]<yamada[k]+unko[j].second)yamada[k+unko[j].first]=yamada[k]+unko[j].second;
        }
        x=yamada[x];
        
    }
    printf("%d\n",x);
    return 0;
}

Submission Info

Submission Time
Task A - Invest Master
User xxkiritoxx
Language C++ (GCC 5.4.1)
Score 100
Code Size 885 Byte
Status AC
Exec Time 12 ms
Memory 764 KB

Compile Error

./Main.cpp: In function ‘int main()’:
./Main.cpp:13:31: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d %d %d",&n,&d,&x);
                               ^
./Main.cpp:15:65: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
     for(int i=0;i<d;i++)for(int j=0;j<n;j++)scanf("%d",&p[i][j]);
                                                                 ^

Judge Result

Set Name All
Score / Max Score 100 / 100
Status
AC × 35
Set Name Test Cases
All 00_sample01.txt, 00_sample02.txt, 00_sample03.txt, 00_sample04.txt, 05_anti_greedy.txt, 10_rand_small00.txt, 10_rand_small01.txt, 10_rand_small02.txt, 10_rand_small03.txt, 10_rand_small04.txt, 10_rand_small05.txt, 10_rand_small06.txt, 10_rand_small07.txt, 10_rand_small08.txt, 10_rand_small09.txt, 20_rand_medium00.txt, 20_rand_medium01.txt, 20_rand_medium02.txt, 20_rand_medium03.txt, 20_rand_medium04.txt, 20_rand_medium05.txt, 20_rand_medium06.txt, 20_rand_medium07.txt, 20_rand_medium08.txt, 20_rand_medium09.txt, 30_rand_large00.txt, 30_rand_large01.txt, 30_rand_large02.txt, 30_rand_large03.txt, 30_rand_large04.txt, 30_rand_large05.txt, 30_rand_large06.txt, 30_rand_large07.txt, 30_rand_large08.txt, 30_rand_large09.txt
Case Name Status Exec Time Memory
00_sample01.txt AC 3 ms 764 KB
00_sample02.txt AC 1 ms 640 KB
00_sample03.txt AC 2 ms 640 KB
00_sample04.txt AC 2 ms 640 KB
05_anti_greedy.txt AC 2 ms 640 KB
10_rand_small00.txt AC 2 ms 640 KB
10_rand_small01.txt AC 2 ms 640 KB
10_rand_small02.txt AC 2 ms 640 KB
10_rand_small03.txt AC 2 ms 640 KB
10_rand_small04.txt AC 2 ms 640 KB
10_rand_small05.txt AC 2 ms 640 KB
10_rand_small06.txt AC 1 ms 640 KB
10_rand_small07.txt AC 2 ms 640 KB
10_rand_small08.txt AC 2 ms 640 KB
10_rand_small09.txt AC 2 ms 640 KB
20_rand_medium00.txt AC 2 ms 640 KB
20_rand_medium01.txt AC 2 ms 640 KB
20_rand_medium02.txt AC 2 ms 640 KB
20_rand_medium03.txt AC 2 ms 640 KB
20_rand_medium04.txt AC 2 ms 640 KB
20_rand_medium05.txt AC 2 ms 640 KB
20_rand_medium06.txt AC 2 ms 640 KB
20_rand_medium07.txt AC 2 ms 640 KB
20_rand_medium08.txt AC 2 ms 640 KB
20_rand_medium09.txt AC 2 ms 640 KB
30_rand_large00.txt AC 12 ms 640 KB
30_rand_large01.txt AC 12 ms 640 KB
30_rand_large02.txt AC 12 ms 640 KB
30_rand_large03.txt AC 12 ms 640 KB
30_rand_large04.txt AC 12 ms 640 KB
30_rand_large05.txt AC 12 ms 640 KB
30_rand_large06.txt AC 12 ms 640 KB
30_rand_large07.txt AC 12 ms 640 KB
30_rand_large08.txt AC 12 ms 640 KB
30_rand_large09.txt AC 12 ms 640 KB