Submission #3768542
Source Code Expand
#include <algorithm>
#include <bitset>
#include <cctype>
#include <chrono>
#include <cmath>
#include <cstdio>
#include <ctime>
#include <deque>
#include <iostream>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <string>
#include <tuple>
#include <unordered_map>
#include <vector>
using namespace std;
#define FOR(i,m,n) for(int i=(m);i<(n);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
const int INF = 0x3f3f3f3f;
const long long LINF = 0x3f3f3f3f3f3f3f3fLL;
/*----------------------------------------*/
int main() {
cin.tie(0); ios::sync_with_stdio(false);
// freopen("input.txt", "r", stdin);
int n, m; cin >> n >> m;
vector<tuple<int, int, int, int>> com(n);
REP(i, n) {
int a, b, c, w; cin >> a >> b >> c >> w;
com[i] = make_tuple(a, b, c, w);
}
vector<tuple<int, int, int>> per(m);
REP(i, m) {
int x, y, z; cin >> x >> y >> z;
per[i] = make_tuple(x, y, z);
}
vector<vector<vector<int>>> dp(101, vector<vector<int>>(101, vector<int>(101, 0)));
REP(i, n) REP(a, 101) REP(b, 101) REP(c, 101) {
if (a >= get<0>(com[i]) && b >= get<1>(com[i]) && c >= get<2>(com[i])) {
dp[a][b][c] = max(dp[a][b][c], get<3>(com[i]));
}
}
REP(i, m) {
cout << dp[get<0>(per[i])][get<1>(per[i])][get<2>(per[i])] << '\n';
}
return 0;
}
Submission Info
Submission Time |
|
Task |
C - Optimal Recommendations |
User |
emthrm |
Language |
C++14 (GCC 5.4.1) |
Score |
0 |
Code Size |
1387 Byte |
Status |
TLE |
Exec Time |
2104 ms |
Memory |
7040 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 |
TLE |
2104 ms |
6016 KB |
10-random-01.txt |
AC |
5 ms |
4736 KB |
10-random-02.txt |
TLE |
2104 ms |
5120 KB |
10-random-03.txt |
TLE |
2104 ms |
5504 KB |
10-random-04.txt |
TLE |
2104 ms |
5376 KB |
20-absW-00.txt |
TLE |
2104 ms |
6016 KB |
20-absW-01.txt |
AC |
5 ms |
4736 KB |
20-absW-02.txt |
TLE |
2104 ms |
5632 KB |
20-absW-03.txt |
TLE |
2104 ms |
5632 KB |
20-absW-04.txt |
TLE |
2104 ms |
4992 KB |
30-balance-00.txt |
TLE |
2104 ms |
6016 KB |
30-balance-01.txt |
AC |
6 ms |
4736 KB |
30-balance-02.txt |
TLE |
2103 ms |
7040 KB |
30-balance-03.txt |
TLE |
2104 ms |
5632 KB |
30-balance-04.txt |
TLE |
2104 ms |
5248 KB |
40-limit_dim-00.txt |
TLE |
2104 ms |
6016 KB |
40-limit_dim-01.txt |
TLE |
2104 ms |
6016 KB |
40-limit_dim-02.txt |
TLE |
2103 ms |
6016 KB |
40-limit_dim-03.txt |
TLE |
2104 ms |
6016 KB |
40-limit_dim-04.txt |
TLE |
2103 ms |
6016 KB |
40-limit_dim-05.txt |
TLE |
2104 ms |
6016 KB |
40-limit_dim-06.txt |
TLE |
2104 ms |
6016 KB |
Corner1.txt |
AC |
8 ms |
4736 KB |
Sample1.txt |
AC |
9 ms |
4736 KB |