답안 #508377

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
508377 2022-01-13T09:46:18 Z CyberSleeper Potatoes and fertilizers (LMIO19_bulves) C++14
20 / 100
1000 ms 824 KB
#include <bits/stdc++.h>
#define fastio      ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define debug(x)    cout << "Line " << __LINE__ << ", " << #x << " is " << x << endl
#define fi          first
#define se          second
#define mp          make_pair
#define pb          push_back
#define ll          int
#define ull         unsigned long long
#define pii         pair<int, int>
#define pll         pair<ll, ll>
#define ld          long double
#define nl          '\n'
#define tb          '\t'
#define sp          ' '
using namespace std;

const int MX=3005, MOD=998244353, BLOCK=327, INF=1e9+7;
const ll INFF=1e18+7;
const ld ERR=1e-7, pi=3.14159265358979323846;

ll N, A, DP[2][30005];

int main(){
    fastio;
    cin >> N;
    for(ll ii=1, now, bef; ii<=N; ii++){
        now=ii%2, bef=now^1;
        ll a, b;
        cin >> a >> b;
        A+=a-b;
        for(ll j=0; j<=30000; j++){
            DP[now][j]=DP[bef][j]+abs(j-A);
            if(j>0)
                DP[now][j]=min(DP[now][j], DP[now][j-1]);
        }
    }
    cout << DP[N%2][A] << nl;
}

Compilation message

bulves.cpp:19:19: warning: overflow in conversion from 'double' to 'int' changes value from '1.0e+18' to '2147483647' [-Woverflow]
   19 | const ll INFF=1e18+7;
      |               ~~~~^~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 460 KB Output is correct
2 Correct 298 ms 548 KB Output is correct
3 Correct 296 ms 568 KB Output is correct
4 Execution timed out 1038 ms 648 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 460 KB Output is correct
2 Correct 298 ms 548 KB Output is correct
3 Correct 296 ms 568 KB Output is correct
4 Execution timed out 1038 ms 648 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 460 KB Output is correct
2 Correct 298 ms 548 KB Output is correct
3 Correct 1 ms 452 KB Output is correct
4 Correct 101 ms 548 KB Output is correct
5 Correct 147 ms 580 KB Output is correct
6 Correct 310 ms 548 KB Output is correct
7 Correct 298 ms 552 KB Output is correct
8 Correct 297 ms 460 KB Output is correct
9 Correct 312 ms 452 KB Output is correct
10 Correct 320 ms 568 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 460 KB Output is correct
2 Correct 298 ms 548 KB Output is correct
3 Correct 296 ms 568 KB Output is correct
4 Correct 1 ms 452 KB Output is correct
5 Correct 101 ms 548 KB Output is correct
6 Correct 147 ms 580 KB Output is correct
7 Correct 310 ms 548 KB Output is correct
8 Correct 298 ms 552 KB Output is correct
9 Correct 297 ms 460 KB Output is correct
10 Correct 312 ms 452 KB Output is correct
11 Correct 320 ms 568 KB Output is correct
12 Runtime error 203 ms 824 KB Execution killed with signal 11
13 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 460 KB Output is correct
2 Correct 298 ms 548 KB Output is correct
3 Correct 296 ms 568 KB Output is correct
4 Correct 1 ms 452 KB Output is correct
5 Correct 101 ms 548 KB Output is correct
6 Correct 147 ms 580 KB Output is correct
7 Correct 310 ms 548 KB Output is correct
8 Correct 298 ms 552 KB Output is correct
9 Correct 297 ms 460 KB Output is correct
10 Correct 312 ms 452 KB Output is correct
11 Execution timed out 1038 ms 648 KB Time limit exceeded
12 Halted 0 ms 0 KB -