Submission #19179090


Source Code Expand

Copy
#include <iostream>
#include <iomanip>
#include <fstream>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <vector>
#include <algorithm>
#include <cmath>
#include <chrono>

using namespace std;

int dp[101][101][101];

bool w_compare(vector<int64_t> v, vector<int64_t> u) {
    return v[3] < u[3];
}

int main(int argc, const char * argv[]) {

    ios::sync_with_stdio(false);
    cin.tie(0);
    
    int N, M; cin >> N >> M;
    vector<vector<int64_t>> abcw(N + 1, vector<int64_t>(4));
    abcw[0][0] = abcw[0][1] = abcw[0][2] = abcw[0][3] = 0;
    for (int i = 1; i <= N; i++) cin >> abcw[i][0] >> abcw[i][1] >> abcw[i][2] >> abcw[i][3];
    sort(abcw.begin(), abcw.end(), w_compare);
    
    dp[100][100][100] = N;
    
    for (int i = 100; i >= 0; i--) {
        for (int j = 100; j >= 0; j--) {
            for (int k = 100; k >= 0; k--) {
                int cl = dp[min(100, i + 1)][min(100, j + 1)][min(100, k + 1)];
                while (abcw[cl][0] > i || abcw[cl][1] > j || abcw[cl][2] > k) cl--;
                dp[i][j][k] = cl;
            }
        }
    }
    
    for (int i = 0; i < M; i++) {
        int x, y, z; cin >> x >> y >> z;
        cout << abcw[dp[x][y][z]][3] << endl;
    }
    
    return 0;
    
}

Submission Info

Submission Time
Task C - Optimal Recommendations
User parsley69
Language C++ (GCC 9.2.1)
Score 0
Code Size 1309 Byte
Status TLE
Exec Time 2206 ms
Memory 10812 KB

Compile Error

./Main.cpp: In function ‘int main(int, const char**)’:
./Main.cpp:21:14: warning: unused parameter ‘argc’ [-Wunused-parameter]
   21 | int main(int argc, const char * argv[]) {
      |          ~~~~^~~~
./Main.cpp:21:33: warning: unused parameter ‘argv’ [-Wunused-parameter]
   21 | int main(int argc, const char * argv[]) {
      |                    ~~~~~~~~~~~~~^~~~~~

Judge Result

Set Name All
Score / Max Score 0 / 100
Status
AC × 20
TLE × 4
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 353 ms 10716 KB
10-random-01.txt AC 12 ms 7524 KB
10-random-02.txt AC 103 ms 7756 KB
10-random-03.txt AC 225 ms 8280 KB
10-random-04.txt AC 189 ms 9632 KB
20-absW-00.txt TLE 2206 ms 8800 KB
20-absW-01.txt AC 14 ms 7540 KB
20-absW-02.txt TLE 2206 ms 8624 KB
20-absW-03.txt AC 1876 ms 8944 KB
20-absW-04.txt AC 713 ms 8064 KB
30-balance-00.txt AC 350 ms 10812 KB
30-balance-01.txt AC 15 ms 7504 KB
30-balance-02.txt AC 82 ms 7844 KB
30-balance-03.txt AC 279 ms 10792 KB
30-balance-04.txt AC 138 ms 7776 KB
40-limit_dim-00.txt AC 145 ms 10768 KB
40-limit_dim-01.txt AC 221 ms 10748 KB
40-limit_dim-02.txt AC 204 ms 10784 KB
40-limit_dim-03.txt TLE 2206 ms 9056 KB
40-limit_dim-04.txt AC 188 ms 10772 KB
40-limit_dim-05.txt TLE 2206 ms 10084 KB
40-limit_dim-06.txt AC 1688 ms 10796 KB
Corner1.txt AC 16 ms 7508 KB
Sample1.txt AC 11 ms 7660 KB