254B - Jury Size - CodeForces Solution


brute force implementation *1500

Please click on ads to support us..

C++ Code:

#include <iostream>
#include <fstream>

using namespace std;

int d[500];

int main() {
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    int m[12] = {0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334};
    int n, mt, day, t, p;
    cin >> n;
    for (int i = 0; i < n; ++i) {
        cin >> mt >> day >> p >> t;
        mt = 100 + m[mt - 1] + day;
        for (int j = mt - t; j < mt; ++j) {
            d[j] += p;
        }
    }
    mt = 0;
    for (int i = 0; i < 500; ++i) {
        if (d[i] > mt) {
            mt = d[i];
        }
    }
    cout << mt;
    return 0;
}


Comments

Submit
0 Comments
More Questions

Health of a person
Divisibility
A. Movement
Numbers in a matrix
Sequences
Split houses
Divisible
Three primes
Coprimes
Cost of balloons
One String No Trouble
Help Jarvis!
Lift queries
Goki and his breakup
Ali and Helping innocent people
Book of Potion making
Duration
Birthday Party
e-maze-in
Bricks Game
Char Sum
Two Strings
Anagrams
Prime Number
Lexical Sorting Reloaded
1514A - Perfectly Imperfect Array
580A- Kefa and First Steps
1472B- Fair Division
996A - Hit the Lottery
MSNSADM1 Football