Submission #467231

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
4672312021-08-22 06:44:01Leonardo_PaesHighway Tolls (IOI18_highway)C++17
0 / 100
162 ms9252 KiB
#include "highway.h"
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> pii;
#define f first
#define s second
/* ask with a vector saying the edge value (a or b) for each edge to know the smallest dist
1) find an edge in the path S -> T:
D&C in the edges, trying to find anyone that is in the path.
To do so, just paint everything with A and get the min dist from S to T
Then, in the D&C paint all edges at the current set with B, if it changes
the distance from S to T, than of these edges is in the path.
2) Let e be an edge in the path S -> T, how to find one of the endpoints, S or T ?
multisource bfs from the endpoints of e. Then enumerate the edges
according to their distante. Do bb in the prefix of edges, the last one that
changes the dist from S to T has S or T as the farthest endpoint.
3) Just do step 2) again
*/
const int maxn = 9e4 + 10;
vector<int> grafo[maxn];
int find_edge(int &n, int &m, vector<int> &u, vector<int> &v, int &a, int &b, int &d){ // log m queries
int l = 0, mid, r = m-1;
while(l != r){
mid = (l + r) >> 1;
vector<int> aux(m, 0);
for(int i=0; i<=mid; i++) aux[i] = 1;
if(ask(aux) != d) r = mid;
else l = mid + 1;
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Compilation message (stderr)

highway.cpp: In function 'pii find_endpoints(int&, int&, std::vector<int>&, std::vector<int>&, int&, int&, int&, int&)':
highway.cpp:66:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   66 |    for(int i=meio; i<sbt[j].size(); i++) mark[sbt[j][i].s] = 1;
      |                    ~^~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...