Submission #918115

# Submission time Handle Problem Language Result Execution time Memory
918115 2024-01-29T13:11:03 Z fuad27 Easter Eggs (info1cup17_eastereggs) C++17
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
#include "grader.h"
using namespace std;
const int n = 1000;
vector<int> g[n];
vector<int> v;
void dfs(int at, int p) {
  v.push_back(at);
  for(int to:g[at]) {
    if(to==p)continue;
    dfs(to, at);
  }
}
int findEgg (int N, vector < pair < int, int > > bridges)
{
  for(auto i:bridges) {
    g[i.first].push_back(i.second);
    g[i.second].push_back(i.first);
  }
  dfs(1,0);
  int l = 1, r = v.size()-1, res = -1;
  while(l <= r) {
    int mid = (l+r)/2;
    vector<int> q;
    for(int i = 0;i<=mid;i++)q.push_back(v[i]);
    if(query(q)) {
      r=mid-1;
      res=v[mid];#include <bits/stdc++.h>
#include "grader.h"
using namespace std;
const int n = 1000;
vector<int> g[n];
vector<int> v;
void dfs(int at, int p) {
  v.push_back(at);
  for(int to:g[at]) {
    if(to==p)continue;
    dfs(to, at);
  }
}
int findEgg (int N, vector < pair < int, int > > bridges)
{
  for(auto i:bridges) {
    g[i.first].push_back(i.second);
    g[i.second].push_back(i.first);
  }
  dfs(1,0);
  int l = 1, r = v.size()-1, res = -1;
  while(l <= r) {
    int mid = (l+r)/2;
    vector<int> q;
    for(int i = 0;i<=mid;i++)q.push_back(v[i]);
    if(query(q)) {
      r=mid-1;
      res=v[mid];
    }
    else {
      l=mid+1;
    }
  }
  if(res == -1)res=v[0];
  v.clear();
  for(int i = 1;i<=N;i++)g[i].clear();
  return res;
}

    }
    else {
      l=mid+1;
    }
  }
  if(res == -1)res=v[0];
  v.clear();
  for(int i = 1;i<=N;i++)g[i].clear();
  return res;
}

Compilation message

eastereggs.cpp:28:18: error: stray '#' in program
   28 |       res=v[mid];#include <bits/stdc++.h>
      |                  ^
eastereggs.cpp: In function 'int findEgg(int, std::vector<std::pair<int, int> >)':
eastereggs.cpp:28:19: error: 'include' was not declared in this scope
   28 |       res=v[mid];#include <bits/stdc++.h>
      |                   ^~~~~~~
eastereggs.cpp:28:28: error: 'bits' was not declared in this scope
   28 |       res=v[mid];#include <bits/stdc++.h>
      |                            ^~~~
eastereggs.cpp:28:33: error: 'stdc' was not declared in this scope; did you mean 'std'?
   28 |       res=v[mid];#include <bits/stdc++.h>
      |                                 ^~~~
      |                                 std
In file included from eastereggs.cpp:29:
grader.h:3:1: error: expected primary-expression before 'using'
    3 | using namespace std;
      | ^~~~~
eastereggs.cpp:34:25: error: a function-definition is not allowed here before '{' token
   34 | void dfs(int at, int p) {
      |                         ^
eastereggs.cpp:42:1: error: a function-definition is not allowed here before '{' token
   42 | {
      | ^