Submission #669858

#TimeUsernameProblemLanguageResultExecution timeMemory
669858alvingogoTowns (IOI15_towns)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #include <towns.h> #pragma GCC optimize("Ofast") #define AquA cin.tie(0);ios_base::sync_with_stdio(0); #define fs first #define sc second #define p_q priority_queue using namespace std; map<pair<int,int>,int> > mp; int f(int x,int y){ assert(x!=y); if(x==y){ return 0; } if(x>y){ swap(x,y); } if(mp.find({x,y})!=mp.end()){ return mp[{x,y}]; } return mp[{x,y}]=getDistance(x,y); } int hubDistance(int N,int sub){ int n=N; int a=0; for(int i=0;i<n;i++){ if(f(0,i)>f(0,a)){ a=i; } } int t=a; for(int i=0;i<n;i++){ if(f(a,i)>f(a,t)){ t=i; } } map<int,pair<int,vector<int> > > m; for(int i=0;i<n;i++){ if(i!=a && i!=b){ int d=(f(i,a)+f(i,b)-f(a,b))/2; int x=f(i,a)-d; m[x].fs=max(m[x].fs,d); m[x].fs=max(m[x].fs,max(x,f(a,b)-x)); m[x].sc.push_back(i); } } vector<int> g; for(auto h:m){ g.push_back(h.fs); } int p=g.size(); vector<int> dis(p,0); for(int i=0;i<p;i++){ dis[i]=m[g[i]].fs; for(int j=i+1;j<p;j++){ int u=g[i].fs-g[j].fs; dis[i]=max(dis[i],m[g[j]].fs+u); dis[j]=max(dis[j],m[g[i]].fs+u); } } int y=0; for(int i=0;i<n;i++){ y=max(y,dis[i]); } return y; }

Compilation message (stderr)

towns.cpp:10:24: error: expected unqualified-id before '>' token
   10 | map<pair<int,int>,int> > mp;
      |                        ^
towns.cpp: In function 'int f(int, int)':
towns.cpp:19:8: error: 'mp' was not declared in this scope
   19 |     if(mp.find({x,y})!=mp.end()){
      |        ^~
towns.cpp:22:12: error: 'mp' was not declared in this scope
   22 |     return mp[{x,y}]=getDistance(x,y);
      |            ^~
towns.cpp: In function 'int hubDistance(int, int)':
towns.cpp:40:23: error: 'b' was not declared in this scope
   40 |         if(i!=a && i!=b){
      |                       ^
towns.cpp:52:17: warning: conversion from 'std::vector<int>::size_type' {aka 'long unsigned int'} to 'int' may change value [-Wconversion]
   52 |     int p=g.size();
      |           ~~~~~~^~
towns.cpp:5:12: error: request for member 'first' in 'g.std::vector<int>::operator[](((std::vector<int>::size_type)i))', which is of non-class type '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'}
    5 | #define fs first
      |            ^~~~~
towns.cpp:57:24: note: in expansion of macro 'fs'
   57 |             int u=g[i].fs-g[j].fs;
      |                        ^~
towns.cpp:5:12: error: request for member 'first' in 'g.std::vector<int>::operator[](((std::vector<int>::size_type)j))', which is of non-class type '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'}
    5 | #define fs first
      |            ^~~~~
towns.cpp:57:32: note: in expansion of macro 'fs'
   57 |             int u=g[i].fs-g[j].fs;
      |                                ^~
towns.cpp:24:27: warning: unused parameter 'sub' [-Wunused-parameter]
   24 | int hubDistance(int N,int sub){
      |                       ~~~~^~~