QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#450835#5561. Improving ITEbiarat#WA 1ms5684kbC++201.7kb2024-06-22 18:23:432024-06-22 18:23:45

Judging History

你现在查看的是最新测评结果

  • [2024-06-22 18:23:45]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:5684kb
  • [2024-06-22 18:23:43]
  • 提交

answer

#include <iostream>
#include <string>
#include <set>
#include <map>
#include <algorithm>
#include <iomanip>
#include <vector>
#include <cmath>
#include <queue>
#include <sstream>
#include <ctime>
#include <iterator>
#include <string.h>
#include <stack>
#include <unordered_set>
#include <unordered_map>
#include <bitset>
#include <fstream>
#include <assert.h>
#include <numeric>
#include <complex>
#include <random>
#include <utility>



#define IOS ios_base::sync_with_stdio(0),cin.tie(0), cout.tie(0);
#define FOR(i,a,b) for(int i = (a); i < (b); i++)
#define RFOR(i,a,b) for(int i = (a) - 1; i>=(b);i--)
#define rep(i,n) FOR(i,0,n)
#define PB push_back
#define SZ(a) (int)a.size()
#define ALL(a) a.begin(), a.end()
#define VI vector<int>
#define PII pair<int,int>
#define PLL pair<long long,long long>
#define VL vector<long long >
#define FILL(a, value) memset(a, value, sizeof(a))
const int nax = 2 * (int)1e5 + 147;
 
using namespace std;
 
const int MOD = 998244353;
const int INF = 1e9 +47 ;
const long long LINF = (long long)1e18 + 4747;
 
typedef long long LL;
const double EPS=1e-6;

long long dp[5 * (int)1e5 + 47];
vector<int> vec[5 * (int)1e5 + 47];
long long p[5 * (int)1e5 + 47];
int main() {
    int n,m;
    cin >> n >> m;
    for(int i = 0;i < n;i ++ ) {
        cin >> p[i];
        for(int j = 0; j < min(m,n - i  + 1);j ++ ) {
            int x;
            cin >> x;
            vec[i].push_back(x);
        }
    }
    for(int i = 0;i < n;i++) {
        dp[i] = -LINF;
    }
    for(int i = 1;i < n;i ++) {
        for(int j = i - 1;j >= max(i - m,0);j-- ) {
            dp[i] = max(dp[i],dp[j] - p[j] + vec[j][i - j]);
        }
    }
    cout << dp[n - 1] << '\n';
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 1ms
memory: 5684kb

input:

4 3
1000 900 800 900
700 600 500 400
1200 1200 1300
600 500

output:

-1000000000000004647

result:

wrong answer 1st lines differ - expected: '100', found: '-1000000000000004647'