Submission #703797

#TimeUsernameProblemLanguageResultExecution timeMemory
703797TS_2392Secret (JOI14_secret)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #include "secret.h" using namespace std; const int N = 1002; int n, a[N], calc[N][N]; int Secret(int x, int y){ return x + (y / 2) * 2; } void dnc(int L, int R){ if(L + 1 >= R) return; int mid = L + R >> 1; calc[mid][mid] = a[mid], calc[mid + 1][mid + 1] = a[mid + 1]; for(int i = mid - 1; i >= L; --i) calc[i][mid] = Secret(a[i], calc[i + 1][mid]); for(int i = mid + 2; i <= R; ++i) calc[mid + 1][i] = Secret(calc[mid + 1][i - 1], a[i]); dnc(L, mid); dnc(mid + 1, R); } void Init(int N_, int A[]){ n = N_; for(int i = 1; i <= n; ++i) a[i] = A[i - 1]; memset(calc, 255, sizeof(calc)); dnc(1, n); } int Query(int L, int R){ ++L; ++R; if(L == R) return a[L]; if(L + 1 == R) return Secret(a[L], a[R]); int i; for(i = L; i < R; ++i) if(calc[L][i] != -1 && calc[i + 1][R] != -1) break; return Secret(calc[L][i], calc[i + 1][R]); }

Compilation message (stderr)

secret.cpp: In function 'void dnc(int, int)':
secret.cpp:11:17: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
   11 |     int mid = L + R >> 1;
      |               ~~^~~
/usr/bin/ld: /tmp/cc1rMy57.o: in function `Secret(int, int)':
secret.cpp:(.text+0x0): multiple definition of `Secret(int, int)'; /tmp/ccCjLQS6.o:grader-full.cpp:(.text+0x2d0): first defined here
collect2: error: ld returned 1 exit status