Submission #1076036

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
10760362024-08-26 10:40:23raduvMouse (info1cup19_mouse)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h>
#include "grader.h"
using namespace std;
void setinterval(int n, int l, int r, int val, vector<int> v){
int i;
for( i = 1; i <= n; i++ ){{
if(i >= l && i <= r)
v[i] = val;
else
v[i] = n + 1; // nu va modifica rezultatul query-ului
}
}
void solve(int n){
vector <int> q;
vector <int> v;
int i, val, st, dr, mij;
for( val = 1; val <= n; val++ ){
// cautam binar pentru fiecare valoare pozitia sa
setinterval(n, 1, n, val, q);
st = 1;
dr = n + 1;
while( dr - st > 1 ){
mij = (st + dr) / 2;
setinterval(n, st, mij, val, q);
if(query(q))
dr = mij;
else
st = mij;
}
v[st] = val;
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Compilation message (stderr)

mouse.cpp: In function 'void setinterval(int, int, int, int, std::vector<int>)':
mouse.cpp:13:18: error: a function-definition is not allowed here before '{' token
   13 | void solve(int n){
      |                  ^
mouse.cpp:34:1: error: expected '}' at end of input
   34 | }
      | ^
mouse.cpp:4:62: note: to match this '{'
    4 | void setinterval(int n, int l, int r, int val, vector<int> v){
      |                                                              ^