Submission #743114

# Submission time Handle Problem Language Result Execution time Memory
743114 2023-05-17T08:10:56 Z salmon Nicelines (RMI20_nicelines) C++14
11 / 100
14 ms 256 KB
#include <bits/stdc++.h>
using namespace std;

#include "nice_lines.h"

void solve(int subtask_id, int N) {
    if(subtask_id != 1){
	    the_lines_are({1}, {0});
	    return;
	}
	
	long double s = -1000000000000;
	long double e =  1000000000000;
	
	
	for(int i = 0; i < 200; i++){
		long double m1 = (s * 2 + e)/3;
		long double m2 = (s + e * 2)/3;
		
		if(query(0,m1) > query(0,m2)){
			s = m1;
		}
		else{
			e = m2;
		}
	}
	
	long double xone = 0;
	long double yone = s;
	
	s = -1000000000000;
	e =  1000000000000;
	
	for(int i = 0; i < 200; i++){
		long double m1 = (s * 2 + e)/3;
		long double m2 = (s + e * 2)/3;
		
		if(query(1,m1) > query(1,m2)){
			s = m1;
		}
		else{
			e = m2;
		}
	}
	
	int a = (int) round(s - yone);
	int b = (int) round(yone);
	
	the_lines_are({a}, {b});
}

Compilation message

nicelines.cpp: In function 'void solve(int, int)':
nicelines.cpp:28:14: warning: unused variable 'xone' [-Wunused-variable]
   28 |  long double xone = 0;
      |              ^~~~
# Verdict Execution time Memory Grader output
1 Correct 10 ms 208 KB Output is correct
2 Correct 13 ms 208 KB Output is correct
3 Correct 14 ms 208 KB Output is correct
4 Correct 12 ms 208 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 208 KB Incorrect
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 208 KB Incorrect
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 256 KB Incorrect
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 208 KB Incorrect
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 256 KB Incorrect
2 Halted 0 ms 0 KB -