Submission #1101144

#TimeUsernameProblemLanguageResultExecution timeMemory
1101144InvMODSecret (JOI14_secret)C++14
Compilation error
0 ms0 KiB
#include<bits/stdc++.h> #include "secret.h" using namespace std; const int N = 1e3+1; int mx_size, pref[N][N]; int Secret(int x, int y){ return min(x + ((y>>1)<<1), (int)1e9); } void Dnc(int l, int r, vector<int>& v){ if(l == r){ pref[l][l] = v[l]; return; } int m = l+r>>1; pref[m][m] = v[m]; pref[m+1][m+1] = v[m+1]; for(int i = m-1; i >= l; i--){ pref[i][m] = Secret(v[i], pref[i+1][m]); } for(int i = m+2; i <= r; i++){ pref[m+1][i] = Secret(pref[m+1][i-1], v[i]); } Dnc(l, m, v); Dnc(m+1, r, v); return; } void Init(int n, int a[]){ vector<int> v; for(int i = 0; i < n; i++){ v.push_back(a[i]); } --n; mx_size = n; Dnc(0, n, v); return; } int get(int l, int r, int Ql, int Qr){ if(l == r){ return pref[l][r]; } else{ int m = l+r>>1; if(Ql <= m && Qr > m){ return Secret(pref[Ql][m], pref[m+1][Qr]); } else{ if(Qr <= m){ return get(l, m, Ql, Qr); } else{ return get(m+1, r, Ql, Qr); } } } return -1; } int Query(int l, int r){ cout << get(0, mx_size, l, r) <<"\n"; }

Compilation message (stderr)

secret.cpp: In function 'void Dnc(int, int, std::vector<int>&)':
secret.cpp:20:14: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
   20 |     int m = l+r>>1;
      |             ~^~
secret.cpp: In function 'int get(int, int, int, int)':
secret.cpp:52:18: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
   52 |         int m = l+r>>1;
      |                 ~^~
secret.cpp: In function 'int Query(int, int)':
secret.cpp:70:1: warning: no return statement in function returning non-void [-Wreturn-type]
   70 | }
      | ^
/usr/bin/ld: /tmp/cclBuGfo.o: in function `Secret(int, int)':
secret.cpp:(.text+0x0): multiple definition of `Secret(int, int)'; /tmp/ccjMcVAl.o:grader.cpp:(.text+0x2d0): first defined here
collect2: error: ld returned 1 exit status