Submission #402074

# Submission time Handle Problem Language Result Execution time Memory
402074 2021-05-11T09:31:12 Z maximath_1 Nicelines (RMI20_nicelines) C++11
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
#include "nice_lines.h"
using namespace std;

#define ll long long
#define ld long double
const ll lim = 10000;
const ld eps = 1e-6;
map<pair<ll, ll>, ld> mp;
vector<int> a, b;

ld que(ll x, ll y){
	if(mp.count({x, y})) return mp[{x, y}];
	return mp[{x, y}] = query(x, y);
}

ll dv(ll a, ll b){
	return a / b + ((a ^ b) < 0 && a % b);#include <bits/stdc++.h>
#include "nice_lines.h"
using namespace std;

#define ll long long
#define ld long double
const ll lim = 10000;
const ld eps = 1e-6;
map<pair<ll, ll>, ld> mp;
vector<int> a, b;

ld que(ll x, ll y){
	if(mp.count({x, y})) return mp[{x, y}];
	return mp[{x, y}] = query(x, y);
}

ll dv(ll a, ll b){
	if(a < 0) return (a - b + 1) / b;
	return a / b;
}

void solve(int subtask_id, int N){
	mp.clear();

	ll x = lim * 2 + 1, y = x * lim + lim;
	ld diff = que(x, -y + 1) - que(x, -y);
	ll last = -y;

	for(int i = 0; i < N; i ++){
		ll lf = 1, rg = lim;
		while(fabs(que(x, last + rg) - (que(x, last) + rg * diff)) < eps){
			diff = (que(x, last + rg) - que(x, last)) / rg;
			rg *= 4;
		}

		for(ll md; lf < rg;){
			md = (lf + rg) / 2;
			if(fabs(que(x, last + md) - (que(x, last) + md * diff)) < eps) lf = md + 1;
			else rg = md;
		}

		last += lf - 1;
		a.push_back((int)dv(last + lim, x));
		b.push_back((int)(last - a.back() * x));

		diff = que(x, last + 1) - que(x, last);
	}

	the_lines_are(a, b);
}
}

void solve(int subtask_id, int N){
	mp.clear();

	ll x = lim * 2 + 1, y = (x + 2) * lim;
	ld diff = que(x, -y + 1) - que(x, -y);
	ll last = -y;

	for(int i = 0; i < N; i ++){
		ll lf = 1, rg = lim;
		while(fabs(que(x, last + rg) - (que(x, last) + rg * diff)) < eps){
			diff = (que(x, last + rg) - que(x, last)) / rg;
			rg *= 4;
		}

		for(ll md; lf < rg;){
			md = (lf + rg) / 2;
			if(fabs(que(x, last + md) - (que(x, last) + md * diff)) < eps) lf = md + 1;
			else rg = md;
		}

		last += lf - 1;
		a.push_back((int)dv(last + lim, x));
		b.push_back((int)(last - a.back() * x));

		diff = que(x, last + 1) - que(x, last);
	}

	the_lines_are(a, b);
}

Compilation message

nicelines.cpp:18:40: error: stray '#' in program
   18 |  return a / b + ((a ^ b) < 0 && a % b);#include <bits/stdc++.h>
      |                                        ^
nicelines.cpp: In function 'long long int dv(long long int, long long int)':
nicelines.cpp:18:41: error: 'include' was not declared in this scope
   18 |  return a / b + ((a ^ b) < 0 && a % b);#include <bits/stdc++.h>
      |                                         ^~~~~~~
nicelines.cpp:18:50: error: 'bits' was not declared in this scope
   18 |  return a / b + ((a ^ b) < 0 && a % b);#include <bits/stdc++.h>
      |                                                  ^~~~
nicelines.cpp:18:55: error: 'stdc' was not declared in this scope; did you mean 'std'?
   18 |  return a / b + ((a ^ b) < 0 && a % b);#include <bits/stdc++.h>
      |                                                       ^~~~
      |                                                       std
nicelines.cpp:20:1: error: expected primary-expression before 'using'
   20 | using namespace std;
      | ^~~~~
nicelines.cpp:27:13: error: declaration of 'std::vector<int> a' shadows a parameter
   27 | vector<int> a, b;
      |             ^
nicelines.cpp:17:10: note: 'long long int a' previously declared here
   17 | ll dv(ll a, ll b){
      |          ^
nicelines.cpp:27:16: error: declaration of 'std::vector<int> b' shadows a parameter
   27 | vector<int> a, b;
      |                ^
nicelines.cpp:17:16: note: 'long long int b' previously declared here
   17 | ll dv(ll a, ll b){
      |                ^
nicelines.cpp:29:19: error: a function-definition is not allowed here before '{' token
   29 | ld que(ll x, ll y){
      |                   ^
nicelines.cpp:34:18: error: a function-definition is not allowed here before '{' token
   34 | ll dv(ll a, ll b){
      |                  ^
nicelines.cpp:39:34: error: a function-definition is not allowed here before '{' token
   39 | void solve(int subtask_id, int N){
      |                                  ^
nicelines.cpp:24:10: warning: unused variable 'lim' [-Wunused-variable]
   24 | const ll lim = 10000;
      |          ^~~
nicelines.cpp:25:10: warning: unused variable 'eps' [-Wunused-variable]
   25 | const ld eps = 1e-6;
      |          ^~~