Submission #1327018

#TimeUsernameProblemLanguageResultExecution timeMemory
1327018apxoLanguages (IOI10_languages)C++20
Compilation error
0 ms0 KiB
#include "bits/stdc++.h"

using namespace std;

#ifdef duc_debug
#include "bits/debug.h"
#else
#define debug(...)
#include "grader.h"
#endif

const int mod = 999983;
const int base = 65536;
int a[56][4];
int d[56][mod];
int weight[] = {1, 2, 3, 4};

void Excerpt(int *E) {
  for (int i = 0; i < 97; ++i) {
    for (int j = 0; j < 4; ++j) {
      a[i][j] = (1ll * (j ? a[i][j - 1] : 0) * base % mod + E[i + j]) % mod;
    }
  }  
  int match = 0, pos = 0;
  for (int i = 0; i < 56; ++i) {
    int cur = 0;
    for (int j = 0; j < 97; ++j) {
      for (int k = 0; k < 4; ++k) {
        cur += d[i][a[j][k]] * weight[k];
      }
    }
    if (match < cur) {
      match = cur, pos = i;
    }
  }
  int L = language(pos);
  for (int i = 0; i < 97; ++i) {
    for (int j = 0; j < 4; ++j) {
      ++d[L][a[i][j]];
    }
  }
}

Compilation message (stderr)

lang.cpp: In function 'void Excerpt(int*)':
lang.cpp:39:20: warning: iteration 56 invokes undefined behavior [-Waggressive-loop-optimizations]
   39 |       ++d[L][a[i][j]];
      |              ~~~~~~^
lang.cpp:37:21: note: within this loop
   37 |   for (int i = 0; i < 97; ++i) {
      |                   ~~^~~~
lang.cpp:29:27: warning: iteration 56 invokes undefined behavior [-Waggressive-loop-optimizations]
   29 |         cur += d[i][a[j][k]] * weight[k];
      |                     ~~~~~~^
lang.cpp:27:23: note: within this loop
   27 |     for (int j = 0; j < 97; ++j) {
      |                     ~~^~~~
lang.cpp:21:15: warning: iteration 56 invokes undefined behavior [-Waggressive-loop-optimizations]
   21 |       a[i][j] = (1ll * (j ? a[i][j - 1] : 0) * base % mod + E[i + j]) % mod;
      |       ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
lang.cpp:19:21: note: within this loop
   19 |   for (int i = 0; i < 97; ++i) {
      |                   ~~^~~~
/usr/bin/ld: /tmp/ccwfQtBM.o: in function `main':
grader.c:(.text.startup+0x12f): undefined reference to `excerpt(int*)'
collect2: error: ld returned 1 exit status