Submission #19451194


Source Code Expand

Copy
#include <iostream>
#include <iomanip>
#include <vector>
#include <set>
#include <string>
#include <queue>
#include <algorithm>
#include <map>
#include <cmath>
#include <numeric>
#include <list>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <tuple>
#include <deque>
#include <complex>
#include <bitset>
#include <functional>
#include <cassert>
//#include <atcoder/all>

using namespace std;
//using namespace atcoder;

using ll = long long;
using vll = vector<ll>;
using vvll = vector<vll>;
using pll = pair<ll, ll>;
using vpll = vector<pll>;
using ld = long double;
using vld = vector<ld>;
using vb = vector<bool>;

#define rep(i, n) for (ll i = 0; i < (n); i++)
#ifdef LOCAL
#define dbg(x) cerr << __LINE__ << " : " << #x << " = " << (x) << endl
#else
#define dbg(x) true
#endif

template <class T> void chmin(T& a, T b) { a = min(a, b);}
template <class T> void chmax(T& a, T b) { a = max(a, b);}
template <class T> ostream& operator<<(ostream& s, const vector<T>& a) { for(auto i : a) s << i << ' '; return s; }

constexpr ll INFL = 1LL << 60;
constexpr ld EPS = 1e-12;
ld PI = acos(-1.0);

void solve() {
    vector<vvll> dp(101, vvll(101, vll(101)));
    ll n, m;
    cin >> n >> m;
    while(n--) {
        ll a, b, c, w;
        cin >> a >> b >> c >> w;
        chmax(dp[a][b][c], w);
    }
    rep(i, 101) rep(j, 101) rep(k, 101) {
        if(i > 0) chmax(dp[i][j][k], dp[i-1][j][k]);
        if(j > 0) chmax(dp[i][j][k], dp[i][j-1][k]);
        if(k > 0) chmax(dp[i][j][k], dp[i][j][k-1]);
    }
    while(m--) {
        ll x, y, z;
        cin >> x >> y >> z;
        cout << dp[x][y][z] << endl;
    }
    return;
}

int main() {
    std::cin.tie(nullptr);
    std::ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    solve();
}

Submission Info

Submission Time
Task C - Optimal Recommendations
User Yoko_303
Language C++ (GCC 9.2.1)
Score 100
Code Size 1878 Byte
Status AC
Exec Time 118 ms
Memory 11888 KB

Judge Result

Set Name All
Score / Max Score 100 / 100
Status
AC × 24
Set Name Test Cases
All 10-random-00.txt, 10-random-01.txt, 10-random-02.txt, 10-random-03.txt, 10-random-04.txt, 20-absW-00.txt, 20-absW-01.txt, 20-absW-02.txt, 20-absW-03.txt, 20-absW-04.txt, 30-balance-00.txt, 30-balance-01.txt, 30-balance-02.txt, 30-balance-03.txt, 30-balance-04.txt, 40-limit_dim-00.txt, 40-limit_dim-01.txt, 40-limit_dim-02.txt, 40-limit_dim-03.txt, 40-limit_dim-04.txt, 40-limit_dim-05.txt, 40-limit_dim-06.txt, Corner1.txt, Sample1.txt
Case Name Status Exec Time Memory
10-random-00.txt AC 118 ms 11840 KB
10-random-01.txt AC 17 ms 11816 KB
10-random-02.txt AC 76 ms 11840 KB
10-random-03.txt AC 92 ms 11776 KB
10-random-04.txt AC 40 ms 11656 KB
20-absW-00.txt AC 114 ms 11776 KB
20-absW-01.txt AC 16 ms 11836 KB
20-absW-02.txt AC 53 ms 11776 KB
20-absW-03.txt AC 99 ms 11776 KB
20-absW-04.txt AC 50 ms 11808 KB
30-balance-00.txt AC 115 ms 11860 KB
30-balance-01.txt AC 20 ms 11772 KB
30-balance-02.txt AC 51 ms 11712 KB
30-balance-03.txt AC 58 ms 11888 KB
30-balance-04.txt AC 93 ms 11884 KB
40-limit_dim-00.txt AC 111 ms 11860 KB
40-limit_dim-01.txt AC 111 ms 11708 KB
40-limit_dim-02.txt AC 110 ms 11416 KB
40-limit_dim-03.txt AC 114 ms 11884 KB
40-limit_dim-04.txt AC 111 ms 11716 KB
40-limit_dim-05.txt AC 109 ms 11708 KB
40-limit_dim-06.txt AC 110 ms 11712 KB
Corner1.txt AC 16 ms 11772 KB
Sample1.txt AC 14 ms 11712 KB