Submission #139069

# Submission time Handle Problem Language Result Execution time Memory
139069 2019-07-31T08:59:08 Z claudy Rice Hub (IOI11_ricehub) C++14
Compilation error
0 ms 0 KB
# include "ricehub.h"
//# pragma GCC optimize("Ofast,no-stack-protector")
//# pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native")
# pragma GCC optimize("Ofast")
# pragma GCC optimization ("unroll-loops")
# include "bits/stdc++.h"
/*
# include <ext/pb_ds/tree_policy.hpp>
# include <ext/pb_ds/assoc_container.hpp>
# include <ext/rope>
*/
std::pair<int,int> DR[] = {{-1,0},{0,1},{1,0},{0,-1},{-1,1},{-1,-1},{1,1},{1,-1}};
# define ll long long
# define clock (clock() * 1000.0 / CLOCKS_PER_SEC)
# define rc(s) return cout << s,0
# define rcg(s) cout << s;exit(0)
# define _ ios_base::sync_with_stdio(false);cin.tie(0);cerr.tie(0);cout.tie(0);
# define db(x) cerr << #x << " = " << x << '\n'
# define pb push_back
# define mp make_pair
# define all(s) s.begin(),s.end()
# define sz(x) (int)((x).size())
using namespace std;


int besthub(int n, int L, int a[], long long B)
{
# define int int128_t
	int l = 1;
	int r = n;
	for(int i = 1;i < n;i++) a[i] += a[i - 1]; 
	while(l < r)
	{
		int len = (l + r + 1) / 2;
		bool ok = 0;
		for(int i = len - 1;i < n;i++)
		{
			int lx = i - len + 1;
			int rx = i;
			int midx = (lx + rx) / 2;
			int f = (a[midx] - (midx ? a[midx - 1] : 0)) * (midx - lx + 1) - a[midx] + (lx ? a[lx - 1] : 0);
			f += a[rx] - (midx ? a[midx - 1] : 0) - (rx - midx + 1) * (a[midx] - (midx ? a[midx - 1] : 0));
			ok |= (f <= B);
		}
		if(ok) l = len;
		else r = len - 1;
	}
	return l;
}

Compilation message

ricehub.cpp:5:0: warning: ignoring #pragma GCC optimization [-Wunknown-pragmas]
 # pragma GCC optimization ("unroll-loops")
 
ricehub.cpp: In function 'int besthub(int, int, int*, long long int)':
ricehub.cpp:28:14: error: 'int128_t' was not declared in this scope
 # define int int128_t
              ^
ricehub.cpp:29:2: note: in expansion of macro 'int'
  int l = 1;
  ^~~
ricehub.cpp:28:14: note: suggested alternative: 'int32_t'
 # define int int128_t
              ^
ricehub.cpp:29:2: note: in expansion of macro 'int'
  int l = 1;
  ^~~
ricehub.cpp:30:6: error: expected ';' before 'r'
  int r = n;
      ^
ricehub.cpp:31:10: error: expected ';' before 'i'
  for(int i = 1;i < n;i++) a[i] += a[i - 1]; 
          ^
ricehub.cpp:31:16: error: 'i' was not declared in this scope
  for(int i = 1;i < n;i++) a[i] += a[i - 1]; 
                ^
ricehub.cpp:32:8: error: 'l' was not declared in this scope
  while(l < r)
        ^
ricehub.cpp:32:12: error: 'r' was not declared in this scope
  while(l < r)
            ^
ricehub.cpp:34:7: error: expected ';' before 'len'
   int len = (l + r + 1) / 2;
       ^~~
ricehub.cpp:36:11: error: expected ';' before 'i'
   for(int i = len - 1;i < n;i++)
           ^
ricehub.cpp:36:23: error: 'i' was not declared in this scope
   for(int i = len - 1;i < n;i++)
                       ^
ricehub.cpp:38:8: error: expected ';' before 'lx'
    int lx = i - len + 1;
        ^~
ricehub.cpp:39:8: error: expected ';' before 'rx'
    int rx = i;
        ^~
ricehub.cpp:40:8: error: expected ';' before 'midx'
    int midx = (lx + rx) / 2;
        ^~~~
ricehub.cpp:41:8: error: expected ';' before 'f'
    int f = (a[midx] - (midx ? a[midx - 1] : 0)) * (midx - lx + 1) - a[midx] + (lx ? a[lx - 1] : 0);
        ^
ricehub.cpp:42:4: error: 'f' was not declared in this scope
    f += a[rx] - (midx ? a[midx - 1] : 0) - (rx - midx + 1) * (a[midx] - (midx ? a[midx - 1] : 0));
    ^
ricehub.cpp:42:11: error: 'rx' was not declared in this scope
    f += a[rx] - (midx ? a[midx - 1] : 0) - (rx - midx + 1) * (a[midx] - (midx ? a[midx - 1] : 0));
           ^~
ricehub.cpp:42:11: note: suggested alternative: 'rc'
    f += a[rx] - (midx ? a[midx - 1] : 0) - (rx - midx + 1) * (a[midx] - (midx ? a[midx - 1] : 0));
           ^~
           rc
ricehub.cpp:42:18: error: 'midx' was not declared in this scope
    f += a[rx] - (midx ? a[midx - 1] : 0) - (rx - midx + 1) * (a[midx] - (midx ? a[midx - 1] : 0));
                  ^~~~
ricehub.cpp:42:18: note: suggested alternative: 'modf'
    f += a[rx] - (midx ? a[midx - 1] : 0) - (rx - midx + 1) * (a[midx] - (midx ? a[midx - 1] : 0));
                  ^~~~
                  modf
ricehub.cpp:45:14: error: 'len' was not declared in this scope
   if(ok) l = len;
              ^~~
ricehub.cpp:45:14: note: suggested alternative: 'mblen'
   if(ok) l = len;
              ^~~
              mblen
ricehub.cpp:46:12: error: 'len' was not declared in this scope
   else r = len - 1;
            ^~~
ricehub.cpp:46:12: note: suggested alternative: 'mblen'
   else r = len - 1;
            ^~~
            mblen
ricehub.cpp:48:9: error: 'l' was not declared in this scope
  return l;
         ^