QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#485387#8049. Equal SumsEasonLiangCompile Error//C++142.3kb2024-07-20 17:20:562024-07-20 17:20:57

Judging History

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

  • [2024-07-20 17:20:57]
  • 评测
  • [2024-07-20 17:20:56]
  • 提交

answer

#include <bits/stdc++.h>
#define FileIO_(file) \
    freopen (file ".in", "r", stdin); \
    freopen (file ".out", "w", stdout);

using namespace std;

template<typename Tp>
inline void chmin (Tp &x, const Tp &y) { if (y < x) x = y; }
template<typename Tp>
inline void chmax (Tp &x, const Tp &y) { if (x < y) x = y; }

typedef double dbl;
typedef long long ll;
typedef long double ldb;
const ll mod = 998'244'353;
const int maxn = 5e2 + 20;
const int maxm = 5e2 + 20;
const int maxa = 5e2 + 20;
int n, m, al[maxn], ar[maxn], bl[maxm], br[maxm];
ll dp[maxn][maxm][2 * maxa];

void init () {}

void add (ll &x, const ll &y) {
    if ((x += y) >= mod) x -= mod;
}

void sub (ll &x, const ll &y) {
    if ((x -= y) < 0) x += mod;
}

void solve () {
    scanf ("%d%d", &n, &m);
    for (int i = 1; i <= n; ++i) {
        scanf ("%d%d", &al[i], &ar[i]);
    }
    for (int i = 1; i <= m; ++i) {
        scanf ("%d%d", &bl[i], &br[i]);
    }
    dp[0][0][maxa] = 1ll;
    dp[0][0][maxa + 1] = -1ll;
    for (int i = 0; i <= n; ++i) {
        for (int j = 0; j <= m; ++j) {
            for (int v = 1; v < maxa; ++v) {
                add (dp[i][j][v], dp[i][j][v - 1]);
                add (dp[i + 1][j][v + al[i + 1]], dp[i][j][v]);
                sub (dp[i + 1][j][v + ar[i + 1] + 1], dp[i][j][v]);
            }
            for (int v = maxa; v < 2 * maxa; ++v) {
                add (dp[i][j][v], dp[i][j][v - 1]);
                add (dp[i][j + 1][v - br[j + 1]], dp[i][j][v]);
                sub (dp[i][j + 1][v - bl[j + 1] + 1], dp[i][j][v]);
            }
        }
    }
    for (int i = 1; i <= n; ++i) {
        for (int j = 1; j <= m; ++j) {
            printf ("%lld ", dp[i][j][maxa]);
        }
        puts ("");
    }
}

int main () {
    // #ifndef LSY
    // FileIO_("");
    // #endif
    int t = 1; init ();
    // scanf ("%d", &t);
    while (t--) solve ();
    return 0;
}

// #ifdef LSY
// bool ed, debug = [] () {
//     static bool st; int memtyp = 0; dbl memsiz = &st - &ed;
//     static const string memstr[] = {"B", "KB", "MB", "GB"};
//     while (memsiz >= 1024.) { ++memtyp; memsiz /= 1024.; }
//     cerr << "Memory: " << memsiz << memstr[memtyp] << endl;
//     return atexit ([] () { cerr << "Time: " << 1000. *
// 		clock () / CLOCKS_PER_SEC << "ms" << endl; });
// } ();
// #endif

详细

answer.code: In function ‘void solve()’:
answer.code:34:11: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   34 |     scanf ("%d%d", &n, &m);
      |     ~~~~~~^~~~~~~~~~~~~~~~
answer.code:36:15: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   36 |         scanf ("%d%d", &al[i], &ar[i]);
      |         ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
answer.code:39:15: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   39 |         scanf ("%d%d", &bl[i], &br[i]);
      |         ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
/tmp/ccykygjj.o: in function `solve()':
answer.code:(.text+0x59): relocation truncated to fit: R_X86_64_PC32 against symbol `m' defined in .bss section in /tmp/ccykygjj.o
answer.code:(.text+0x60): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccykygjj.o
answer.code:(.text+0x6b): relocation truncated to fit: R_X86_64_PC32 against symbol `ar' defined in .bss section in /tmp/ccykygjj.o
answer.code:(.text+0x74): relocation truncated to fit: R_X86_64_PC32 against symbol `al' defined in .bss section in /tmp/ccykygjj.o
answer.code:(.text+0x9c): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccykygjj.o
answer.code:(.text+0xc2): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccykygjj.o
answer.code:(.text+0xca): relocation truncated to fit: R_X86_64_PC32 against symbol `m' defined in .bss section in /tmp/ccykygjj.o
answer.code:(.text+0xdc): relocation truncated to fit: R_X86_64_PC32 against symbol `br' defined in .bss section in /tmp/ccykygjj.o
answer.code:(.text+0xe3): relocation truncated to fit: R_X86_64_PC32 against symbol `bl' defined in .bss section in /tmp/ccykygjj.o
answer.code:(.text+0x100): relocation truncated to fit: R_X86_64_PC32 against symbol `m' defined in .bss section in /tmp/ccykygjj.o
answer.code:(.text+0x11b): additional relocation overflows omitted from the output
collect2: error: ld returned 1 exit status