Submission #2979488
Source Code Expand
#include <bits/stdc++.h> using namespace std; using ll = long long; #define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i)) #define all(x) (x).begin(),(x).end() #define pb push_back #define fi first #define se second #define dbg(x) cout<<#x" = "<<((x))<<endl template<class T,class U> ostream& operator<<(ostream& o, const pair<T,U> &p){o<<"("<<p.fi<<","<<p.se<<")";return o;} template<class T> ostream& operator<<(ostream& o, const vector<T> &v){o<<"[";for(T t:v){o<<t<<",";}o<<"]";return o;} const int N = 101; int dp[N][N][N]; int main(){ int n,m; cin >>n >>m; rep(i,n){ int a,b,c,w; cin >>a >>b >>c >>w; dp[a][b][c] = w; } rep(i,N)rep(j,N)rep(k,N){ if(i+1<N) dp[i+1][j][k] = max(dp[i+1][j][k], dp[i][j][k]); if(j+1<N) dp[i][j+1][k] = max(dp[i][j+1][k], dp[i][j][k]); if(k+1<N) dp[i][j][k+1] = max(dp[i][j][k+1], dp[i][j][k]); } rep(i,m){ int x,y,z; cin >>x >>y >>z; cout << dp[x][y][z] << endl; } return 0; }
Submission Info
Submission Time | |
---|---|
Task | C - Optimal Recommendations |
User | imulan |
Language | C++14 (GCC 5.4.1) |
Score | 0 |
Code Size | 1059 Byte |
Status | WA |
Exec Time | 192 ms |
Memory | 4736 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 | 178 ms | 4736 KB |
10-random-01.txt | AC | 7 ms | 4224 KB |
10-random-02.txt | AC | 85 ms | 4608 KB |
10-random-03.txt | WA | 119 ms | 4608 KB |
10-random-04.txt | WA | 63 ms | 4352 KB |
20-absW-00.txt | AC | 164 ms | 4480 KB |
20-absW-01.txt | AC | 7 ms | 4224 KB |
20-absW-02.txt | AC | 84 ms | 4352 KB |
20-absW-03.txt | AC | 131 ms | 4480 KB |
20-absW-04.txt | AC | 51 ms | 4352 KB |
30-balance-00.txt | WA | 181 ms | 4736 KB |
30-balance-01.txt | AC | 7 ms | 4224 KB |
30-balance-02.txt | AC | 50 ms | 4480 KB |
30-balance-03.txt | WA | 103 ms | 4480 KB |
30-balance-04.txt | WA | 115 ms | 4736 KB |
40-limit_dim-00.txt | WA | 191 ms | 4736 KB |
40-limit_dim-01.txt | WA | 185 ms | 4736 KB |
40-limit_dim-02.txt | WA | 187 ms | 4736 KB |
40-limit_dim-03.txt | WA | 183 ms | 4736 KB |
40-limit_dim-04.txt | WA | 192 ms | 4736 KB |
40-limit_dim-05.txt | WA | 181 ms | 4736 KB |
40-limit_dim-06.txt | WA | 184 ms | 4736 KB |
Corner1.txt | WA | 7 ms | 4224 KB |
Sample1.txt | AC | 7 ms | 4224 KB |