Submission #413403

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
4134032021-05-28 16:50:16souvenir_vayneFactories (JOI14_factories)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h>
#include "factories.h"
#define pb push_back
#define LINF 0x3f3f3f3f3f3f3f3f
#define endl '\n'
#define ll long long
#define f first
#define s second
typedef pair<int, int> pii;
using namespace std;
const int MAXN = 5e5+5;
int anc[MAXN][22], al[MAXN], h[MAXN], pai[MAXN], sz[MAXN], used[MAXN], best[MAXN];
vector<pii> g[MAXN];
int getsz(int u, int p) {
sz[u] = 1;
for(pii &i : g[u])
if(i.f != p && !used[i.f])
sz[u] += getsz(i.f, u);
return sz[u];
}
int findc(int u, int p, int n) {
for(pii &i : g[u])
if(i.f != p && !used[i.f] && sz[i.f] > n/2)
return findc(i.f, u, n);
return u;
}
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Compilation message (stderr)

factories.cpp:9:9: error: 'pair' does not name a type
    9 | typedef pair<int, int> pii;
      |         ^~~~
factories.cpp:14:8: error: 'pii' was not declared in this scope; did you mean 'pai'?
   14 | vector<pii> g[MAXN];
      |        ^~~
      |        pai
factories.cpp:14:11: error: template argument 1 is invalid
   14 | vector<pii> g[MAXN];
      |           ^
factories.cpp:14:11: error: template argument 2 is invalid
factories.cpp: In function 'int getsz(int, int)':
factories.cpp:18:9: error: 'pii' was not declared in this scope; did you mean 'pai'?
   18 |     for(pii &i : g[u])
      |         ^~~
      |         pai
factories.cpp:18:16: error: found ':' in nested-name-specifier, expected '::'
   18 |     for(pii &i : g[u])
      |                ^
      |                ::
factories.cpp:18:14: error: 'i' has not been declared
   18 |     for(pii &i : g[u])
      |              ^
factories.cpp:21:5: error: expected primary-expression before 'return'
   21 |     return sz[u];
      |     ^~~~~~
factories.cpp:20:36: error: expected ';' before 'return'
   20 |             sz[u] += getsz(i.f, u);
      |                                    ^
      |                                    ;
   21 |     return sz[u];
      |     ~~~~~~                          
factories.cpp:21:5: error: expected primary-expression before 'return'
   21 |     return sz[u];
      |     ^~~~~~
factories.cpp:20:36: error: expected ')' before 'return'
   20 |             sz[u] += getsz(i.f, u);
      |                                    ^
      |                                    )
   21 |     return sz[u];
      |     ~~~~~~                          
factories.cpp:18:8: note: to match this '('
   18 |     for(pii &i : g[u])
      |        ^
factories.cpp: In function 'int findc(int, int, int)':
factories.cpp:25:9: error: 'pii' was not declared in this scope; did you mean 'pai'?
   25 |     for(pii &i : g[u])
      |         ^~~
      |         pai
factories.cpp:25:16: error: found ':' in nested-name-specifier, expected '::'
   25 |     for(pii &i : g[u])
      |                ^
      |                ::
factories.cpp:25:14: error: 'i' has not been declared
   25 |     for(pii &i : g[u])
      |              ^
factories.cpp:28:5: error: expected primary-expression before 'return'
   28 |     return u;
      |     ^~~~~~
factories.cpp:27:37: error: expected ';' before 'return'
   27 |             return findc(i.f, u, n);
      |                                     ^
      |                                     ;
   28 |     return u;
      |     ~~~~~~                           
factories.cpp:28:5: error: expected primary-expression before 'return'
   28 |     return u;
      |     ^~~~~~
factories.cpp:27:37: error: expected ')' before 'return'
   27 |             return findc(i.f, u, n);
      |                                     ^
      |                                     )
   28 |     return u;
      |     ~~~~~~                           
factories.cpp:25:8: note: to match this '('
   25 |     for(pii &i : g[u])
      |        ^
factories.cpp: In function 'void build(int, int)':
factories.cpp:36:9: error: 'pii' was not declared in this scope; did you mean 'pai'?
   36 |     for(pii &i : g[c])
      |         ^~~
      |         pai
factories.cpp:36:16: error: found ':' in nested-name-specifier, expected '::'
   36 |     for(pii &i : g[c])
      |                ^
      |                ::
factories.cpp:36:14: error: 'i' has not been declared
   36 |     for(pii &i : g[c])
      |              ^
factories.cpp:39:1: error: expected primary-expression before '}' token
   39 | }
      | ^
factories.cpp:38:27: error: expected ';' before '}' token
   38 |             build(i.f, c);
      |                           ^
      |                           ;
   39 | }
      | ~                          
factories.cpp:39:1: error: expected primary-expression before '}' token
   39 | }
      | ^
factories.cpp:38:27: error: expected ')' before '}' token
   38 |             build(i.f, c);
      |                           ^
      |                           )
   39 | }
      | ~                          
factories.cpp:36:8: note: to match this '('
   36 |     for(pii &i : g[c])
      |        ^
factories.cpp:39:1: error: expected primary-expression before '}' token
   39 | }
      | ^
factories.cpp: In function 'void dfs(int)':
factories.cpp:43:9: error: 'pii' was not declared in this scope; did you mean 'pai'?
   43 |     for(pii &i : g[u])
      |         ^~~
      |         pai
factories.cpp:43:16: error: found ':' in nested-name-specifier, expected '::'
   43 |     for(pii &i : g[u])
      |                ^
      |                ::
factories.cpp:43:14: error: 'i' has not been declared
   43 |     for(pii &i : g[u])
      |              ^
factories.cpp:50:1: error: expected primary-expression before '}' token
   50 | }
      | ^
factories.cpp:49:10: error: expected ';' before '}' token
   49 |         }
      |          ^
      |          ;
   50 | }
      | ~         
factories.cpp:50:1: error: expected primary-expression before '}' token
   50 | }
      | ^
factories.cpp:49:10: error: expected ')' before '}' token
   49 |         }
      |          ^
      |          )
   50 | }
      | ~         
factories.cpp:43:8: note: to match this '('
   43 |     for(pii &i : g[u])
      |        ^
factories.cpp:50:1: error: expected primary-expression before '}' token
   50 | }
      | ^
factories.cpp: In function 'int query(int)':
factories.cpp:4:14: warning: overflow in conversion from 'long int' to 'int' changes value from '4557430888798830399' to '1061109567' [-Woverflow]
    4 | #define LINF 0x3f3f3f3f3f3f3f3f
      |              ^~~~~~~~~~~~~~~~~~
factories.cpp:84:24: note: in expansion of macro 'LINF'
   84 |     int aux = u, ans = LINF;
      |                        ^~~~
factories.cpp: In function 'void reset(int)':
factories.cpp:4:14: warning: overflow in conversion from 'long int' to 'int' changes value from '4557430888798830399' to '1061109567' [-Woverflow]
    4 | #define LINF 0x3f3f3f3f3f3f3f3f
      |              ^~~~~~~~~~~~~~~~~~
factories.cpp:94:19: note: in expansion of macro 'LINF'
   94 |         best[u] = LINF;
      |                   ^~~~
factories.cpp: In function 'void Init(int, int*, int*, int*)':
factories.cpp:4:14: warning: overflow in conversion from 'long int' to 'int' changes value from '4557430888798830399' to '1061109567' [-Woverflow]
    4 | #define LINF 0x3f3f3f3f3f3f3f3f
      |              ^~~~~~~~~~~~~~~~~~
factories.cpp:101:19: note: in expansion of macro 'LINF'
  101 |         best[i] = LINF;
      |                   ^~~~
factories.cpp:3:12: error: request for member 'push_back' in 'g[(*(a + ((sizetype)(((long unsigned int)i) * 4))))]', which is of non-class type 'int'
    3 | #define pb push_back
      |            ^~~~~~~~~
factories.cpp:104:17: note: in expansion of macro 'pb'
  104 |         g[a[i]].pb({b[i], c[i]});
      |                 ^~
factories.cpp:3:12: error: request for member 'push_back' in 'g[(*(b + ((sizetype)(((long unsigned int)i) * 4))))]', which is of non-class type 'int'
    3 | #define pb push_back
      |            ^~~~~~~~~
factories.cpp:105:17: note: in expansion of macro 'pb'
  105 |         g[b[i]].pb({a[i], c[i]});
      |                 ^~
factories.cpp: In function 'long long int Query(int, int*, int, int*)':
factories.cpp:4:14: warning: overflow in conversion from 'long int' to 'int' changes value from '4557430888798830399' to '1061109567' [-Woverflow]
    4 | #define LINF 0x3f3f3f3f3f3f3f3f
      |              ^~~~~~~~~~~~~~~~~~
factories.cpp:117:15: note: in expansion of macro 'LINF'
  117 |     int ans = LINF;
      |               ^~~~