Submission #2167913
Source Code Expand
# include <iostream>
# include <algorithm>
#include <array>
# include <cassert>
#include <cctype>
#include <climits>
#include <numeric>
# include <vector>
# include <string>
# include <set>
# include <map>
# include <cmath>
# include <iomanip>
# include <functional>
# include <tuple>
# include <utility>
# include <stack>
# include <queue>
# include <list>
# include <bitset>
# include <complex>
# include <chrono>
# include <random>
# include <limits.h>
# include <unordered_map>
# include <unordered_set>
# include <deque>
# include <cstdio>
# include <cstring>
using namespace std;
using LL = long long;
using ULL = unsigned long long;
constexpr long long MOD = 1000000000 + 7;
constexpr long long INF = 1e17 - 10;
const double PI = acos(-1);
#define fir first
#define sec second
typedef pair<LL, LL> Pll;
typedef pair<LL, pair<LL, LL>> Ppll;
typedef pair<LL, pair<LL, bitset<100001>>> Pbll;
typedef pair<LL, pair<LL, vector<LL>>> Pvll;
typedef pair<LL, LL> Vec2;
struct Tll { LL first, second, third; };
typedef pair<LL, Tll> Ptll;
#define rep(i,rept) for(LL i=0;i<rept;i++)
#define Mfor(i,mf) for(LL i=mf-1;i>=0;i--)
LL h, w, n, m, s, t, q, ans, sum,a[101][101][101],
dp[101][101][101], last;
struct Edge { LL to,cost; };
string str, ss;
pair<char,int> c[1000];
vector<char>v;
bool f[100];
void YN(bool f) {
if (f)
cout << "YES" << endl;
else
cout << "NO" << endl;
}
void yn(bool f) {
if (f)
cout << "Yes" << endl;
else
cout << "No" << endl;
}
int main() {
cin >> n >> m;
rep(i, n) {
LL x, y, z, w;
cin >> x >> y >> z >> w;
a[x][y][z] = max(a[x][y][z], w);
}
rep(i, 101) {
rep(j, 101) {
rep(k, 101) {
if(i>=1&&j>=1&&k>=1)
dp[i][j][k] = max({ dp[i][j][k], a[i][j][k],dp[i - 1][j][k],dp[i][j - 1][k],dp[i][j][k - 1] });
}
}
}
rep(i, m) {
LL x, y, z;
cin >> x >> y >> z;
cout << dp[x][y][z] << endl;
}
return 0;
}
Submission Info
Submission Time |
|
Task |
C - Optimal Recommendations |
User |
akusyounin |
Language |
C++14 (GCC 5.4.1) |
Score |
0 |
Code Size |
1954 Byte |
Status |
WA |
Exec Time |
175 ms |
Memory |
16768 KB |
Judge Result
Set Name |
All |
Score / Max Score |
0 / 100 |
Status |
|
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 |
WA |
170 ms |
16768 KB |
10-random-01.txt |
AC |
9 ms |
10368 KB |
10-random-02.txt |
WA |
88 ms |
16128 KB |
10-random-03.txt |
WA |
116 ms |
16640 KB |
10-random-04.txt |
WA |
58 ms |
16256 KB |
20-absW-00.txt |
WA |
159 ms |
16512 KB |
20-absW-01.txt |
AC |
9 ms |
10368 KB |
20-absW-02.txt |
WA |
80 ms |
16384 KB |
20-absW-03.txt |
WA |
128 ms |
16384 KB |
20-absW-04.txt |
WA |
52 ms |
16384 KB |
30-balance-00.txt |
WA |
166 ms |
16768 KB |
30-balance-01.txt |
WA |
8 ms |
8320 KB |
30-balance-02.txt |
WA |
52 ms |
16000 KB |
30-balance-03.txt |
WA |
94 ms |
16384 KB |
30-balance-04.txt |
WA |
114 ms |
16640 KB |
40-limit_dim-00.txt |
AC |
175 ms |
8832 KB |
40-limit_dim-01.txt |
WA |
173 ms |
15104 KB |
40-limit_dim-02.txt |
WA |
171 ms |
8960 KB |
40-limit_dim-03.txt |
WA |
169 ms |
16768 KB |
40-limit_dim-04.txt |
WA |
171 ms |
8832 KB |
40-limit_dim-05.txt |
WA |
168 ms |
15104 KB |
40-limit_dim-06.txt |
WA |
172 ms |
8960 KB |
Corner1.txt |
AC |
8 ms |
8320 KB |
Sample1.txt |
AC |
9 ms |
10368 KB |