Submission #1053624

#TimeUsernameProblemLanguageResultExecution timeMemory
1053624phongSecret (JOI14_secret)C++17
Compilation error
0 ms0 KiB
//#pragma GCC optimize("Ofast") //#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,fma") //#pragma GCC optimize("unroll-loops") #include "secret.h" #define ll long long const int nmax = 1000 + 5; const ll oo = 1e9 + 5, base = 311; const int lg = 17, tx = 26; const ll mod = 998244353; #define pii pair<ll, ll> #define fi first #define se second #define endl "\n" #define debug(a, n) for(int i = 1; i <= n; ++i) cout << a[i] << ' '; cout << "\n"; using namespace std; int n, a[nmax]; int tree[nmax << 2]; void build(int id, int l, int r){ if(l == r){ tree[id] = a[l]; return; } int mid = r + l >> 1; build(id << 1, l, mid); build(id << 1| 1, mid + 1, r); tree[id] = Secret(tree[id << 1], tree[id << 1 | 1]); } int get(int id, int l, int r, int u, int v){ if(l >= u && r <= v) return tree[id]; int mid = r + l >> 1; if(mid< u) return get(id << 1 | 1, mid + 1, r, u, v); if(mid + 1 > v) return get(id << 1, l, mid, u, v); return Secret(get(id << 1, l, mid, u, v), get(id << 1 | 1, mid + 1, r, u, v)); } void Init(int N, int A[]){ n = N; for(int i = 0; i < n; ++i) a[i] = A[i]; build(1, 0, n - 1); } int Query(int l, int r){ return get(1, 0, n - 1, l, r); } main(){ ios_base::sync_with_stdio(0); cin.tie(0);cout.tie(0); // freopen("code.inp", "r", stdin); // freopen("code.out", "w", stdout); } /* 2 3 1 4 4 1 2 6 5 */

Compilation message (stderr)

secret.cpp: In function 'void build(int, int, int)':
secret.cpp:26:17: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
   26 |     int mid = r + l >> 1;
      |               ~~^~~
secret.cpp: In function 'int get(int, int, int, int, int)':
secret.cpp:33:17: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
   33 |     int mid = r + l >> 1;
      |               ~~^~~
secret.cpp: At global scope:
secret.cpp:48:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   48 | main(){
      | ^~~~
secret.cpp: In function 'int main()':
secret.cpp:49:5: error: 'ios_base' has not been declared
   49 |     ios_base::sync_with_stdio(0);
      |     ^~~~~~~~
secret.cpp:50:5: error: 'cin' was not declared in this scope
   50 |     cin.tie(0);cout.tie(0);
      |     ^~~
secret.cpp:5:1: note: 'std::cin' is defined in header '<iostream>'; did you forget to '#include <iostream>'?
    4 | #include "secret.h"
  +++ |+#include <iostream>
    5 | 
secret.cpp:50:16: error: 'cout' was not declared in this scope
   50 |     cin.tie(0);cout.tie(0);
      |                ^~~~
secret.cpp:50:16: note: 'std::cout' is defined in header '<iostream>'; did you forget to '#include <iostream>'?