Submission #918344

#TimeUsernameProblemLanguageResultExecution timeMemory
918344Ferid20072020Easter Eggs (info1cup17_eastereggs)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #include "grader.h" using namespace std; int color[2e5+5]; vector<vector<int>> g(2e5+5); vector<int> List; void DFS(int node){ color[node] = 1; List.push_back(node); for(auto to : g[node]){ if(color[to] == 0){ DFS(to); } } } int findEgg (int N, vector < pair < int, int > > bridges) { List.clear(); for(int i=0 ; i<2e5 + 5 ; i++){ g[i].clear(); } for(int i=0 ; i<bridges.size() ; i++){ int u = bridges[i].first; int v = bridges[i].second; g[u].push_back(v); g[v].push_back(u); } DFS(1); int l = 0 , r = N - 1; while(l < r){ int mid = (l + r) / 2; vector<int> c; for(int i=l ; i<=mid ; i++){ c.push_back(List[i]); } int ask = query(c); if(ask == 1){ r = mid; } else{ l = mid + 1; } } return List[l]; }

Compilation message (stderr)

eastereggs.cpp:6:14: error: conversion from 'double' to 'long unsigned int' in a converted constant expression
    6 | int color[2e5+5];
      |           ~~~^~
eastereggs.cpp:6:14: error: could not convert '(2.0e+5 + (double)5)' from 'double' to 'long unsigned int'
eastereggs.cpp:6:14: error: size of array 'color' has non-integral type 'double'
eastereggs.cpp: In function 'int findEgg(int, std::vector<std::pair<int, int> >)':
eastereggs.cpp:27:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   27 |     for(int i=0 ; i<bridges.size() ; i++){
      |                   ~^~~~~~~~~~~~~~~