Submission #785440

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
7854402023-07-17 09:08:36ymmTowns (IOI15_towns)C++17
25 / 100
45 ms412 KiB
#include "towns.h"
#include <bits/stdc++.h>
#define Loop(x,l,r) for (ll x = (l); x < (r); ++x)
#define LoopR(x,l,r) for (ll x = (r)-1; x >= (l); --x)
typedef std::pair<int,int> pii;
typedef long long ll;
using namespace std;
const int N = 120;
int dis0[N], disa[N], disb[N];
int dis[N][N];
int cnt;
namespace dsu {
int par[N];
int sz[N];
void init() {
fill(par, par+N, -1);
fill(sz, sz+N, 1);
}
int rt(int v) { return par[v] == -1? v: (par[v] = rt(par[v])); }
void unite(int v, int u) {
v = rt(v);
u = rt(u);
//if (sz[v] < sz[u])
// swap(v, u);
sz[v] += sz[u];
par[u] = v;
}
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Compilation message (stderr)

towns.cpp: In function 'int find_hub(int, int, int, int)':
towns.cpp:58:15: warning: conversion from 'll' {aka 'long long int'} to 'int' may change value [-Wconversion]
   58 |   if (get2(a, i, b) == r)
      |               ^
towns.cpp:60:15: warning: conversion from 'll' {aka 'long long int'} to 'int' may change value [-Wconversion]
   60 |   if (get2(b, i, a) == r)
      |               ^
towns.cpp:62:11: warning: conversion from 'll' {aka 'long long int'} to 'int' may change value [-Wconversion]
   62 |   (get(a, i) < get(b, i)? X: Y).push_back(i);
      |           ^
towns.cpp:62:23: warning: conversion from 'll' {aka 'long long int'} to 'int' may change value [-Wconversion]
   62 |   (get(a, i) < get(b, i)? X: Y).push_back(i);
      |                       ^
towns.cpp:62:43: warning: conversion from 'll' {aka 'long long int'} to 'std::vector<int>::value_type' {aka 'int'} may change value [-Wconversion]
   62 |   (get(a, i) < get(b, i)? X: Y).push_back(i);
      |                                           ^
towns.cpp:68:17: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   68 |  if (X.size()*2 > n)
      |      ~~~~~~~~~~~^~~
towns.cpp:70:17: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   70 |  if (X.size()*2 == n)
      |      ~~~~~~~~~~~^~~~
towns.cpp: In function 'int sel(const std::vector<int>&)':
towns.cpp:79:15: warning: conversion from 'std::mersenne_twister_engine<long unsigned int, 64, 312, 156, 31, 13043109905998158313, 29, 6148914691236517205, 17, 8202884508482404352, 37, 18444473444759240704, 43, 6364136223846793005>::result_type' {aka 'long unsigned int'} to 'int' may change value [-Wconversion]
   79 |  int x = rd() % sum;
      |          ~~~~~^~~~~
towns.cpp:3:40: warning: comparison of integer expressions of different signedness: 'll' {aka 'long long int'} and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    3 | #define Loop(x,l,r) for (ll x = (l); x < (r); ++x)
      |                                        ^
towns.cpp:80:2: note: in expansion of macro 'Loop'
   80 |  Loop (i,0,val.size()) {
      |  ^~~~
towns.cpp:82:11: warning: conversion from 'll' {aka 'long long int'} to 'int' may change value [-Wconversion]
   82 |    return i;
      |           ^
towns.cpp: In function 'int hubDistance(int, int)':
towns.cpp:92:20: warning: conversion from 'll' {aka 'long long int'} to 'int' may change value [-Wconversion]
   92 |   dis0[i] = get(0, i);
      |                    ^
towns.cpp:93:36: warning: conversion from 'long int' to 'int' may change value [-Wconversion]
   93 |  int a = max_element(dis0, dis0+n) - dis0;
      |          ~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~
towns.cpp:95:20: warning: conversion from 'll' {aka 'long long int'} to 'int' may change value [-Wconversion]
   95 |   disa[i] = get(a, i);
      |                    ^
towns.cpp:96:36: warning: conversion from 'long int' to 'int' may change value [-Wconversion]
   96 |  int b = max_element(disa, disa+n) - disa;
      |          ~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~
towns.cpp:98:20: warning: conversion from 'll' {aka 'long long int'} to 'int' may change value [-Wconversion]
   98 |   disb[i] = get(b, i);
      |                    ^
towns.cpp:110:12: warning: conversion from 'll' {aka 'long long int'} to 'int' may change value [-Wconversion]
  110 |   (get2(a, i, b) < v? L:
      |            ^
towns.cpp:111:12: warning: conversion from 'll' {aka 'long long int'} to 'int' may change value [-Wconversion]
  111 |    get2(a, i, b) > v? R:
      |            ^
towns.cpp:112:36: warning: conversion from 'll' {aka 'long long int'} to 'std::vector<int>::value_type' {aka 'int'} may change value [-Wconversion]
  112 |                       M).push_back(i);
      |                                    ^
towns.cpp:114:17: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
  114 |  if (L.size()*2 > n || R.size()*2 > n)
      |      ~~~~~~~~~~~^~~
towns.cpp:114:35: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
  114 |  if (L.size()*2 > n || R.size()*2 > n)
      |                        ~~~~~~~~~~~^~~
towns.cpp:116:17: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
  116 |  if (M.size()*2 <= n)
      |      ~~~~~~~~~~~^~~~
towns.cpp:125:12: warning: declaration of 'v' shadows a previous local [-Wshadow]
  125 |   for (int v : M) {
      |            ^
towns.cpp:105:6: note: shadowed declaration is here
  105 |  int v = find_hub(a, b, n, ans);
      |      ^
#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...