Submission #19179010


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 1308 Byte
Status WA
Exec Time 2206 ms
Memory 10824 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 × 7
WA × 13
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 WA 279 ms 10676 KB
10-random-01.txt AC 12 ms 7604 KB
10-random-02.txt WA 103 ms 7804 KB
10-random-03.txt WA 170 ms 8448 KB
10-random-04.txt WA 159 ms 9612 KB
20-absW-00.txt TLE 2206 ms 8852 KB
20-absW-01.txt AC 13 ms 7596 KB
20-absW-02.txt TLE 2206 ms 8668 KB
20-absW-03.txt WA 1773 ms 8964 KB
20-absW-04.txt WA 670 ms 8060 KB
30-balance-00.txt WA 275 ms 10824 KB
30-balance-01.txt WA 15 ms 7516 KB
30-balance-02.txt WA 76 ms 7884 KB
30-balance-03.txt WA 234 ms 10812 KB
30-balance-04.txt WA 132 ms 7840 KB
40-limit_dim-00.txt AC 144 ms 10764 KB
40-limit_dim-01.txt AC 219 ms 10824 KB
40-limit_dim-02.txt AC 203 ms 10824 KB
40-limit_dim-03.txt TLE 2206 ms 9072 KB
40-limit_dim-04.txt WA 189 ms 10768 KB
40-limit_dim-05.txt TLE 2206 ms 10260 KB
40-limit_dim-06.txt WA 1651 ms 10808 KB
Corner1.txt AC 14 ms 7664 KB
Sample1.txt AC 12 ms 7616 KB