Submission #724236

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
7242362023-04-14 23:25:34badontArranging Shoes (IOI19_shoes)C++17
Compilation error
0 ms0 KiB
#include "shoes.h"
#include <cmath>
#include <cstdlib>
#include <cassert>
template<typename T>
struct fen {
vector<T> tr;
ll mxn;
fen(ll sz) {
mxn = sz;
tr.assign(sz + 5, 0);
}
void upd(ll g, T k) {
g++;
assert(g != 0);
for (; g <= mxn; g += g&-g)
tr[g] += k;
}
T ge(ll g) {
g++;
T res = 0;
for (; g; g -= g&-g)
res += tr[g];
return res;
}
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Compilation message (stderr)

shoes.cpp:8:2: error: 'vector' does not name a type
    8 |  vector<T> tr;
      |  ^~~~~~
shoes.cpp:9:2: error: 'll' does not name a type
    9 |  ll mxn;
      |  ^~
shoes.cpp:11:8: error: expected ')' before 'sz'
   11 |  fen(ll sz) {
      |     ~  ^~~
      |        )
shoes.cpp:16:11: error: 'll' has not been declared
   16 |  void upd(ll g, T k) {
      |           ^~
shoes.cpp:23:7: error: 'll' has not been declared
   23 |  T ge(ll g) {
      |       ^~
shoes.cpp:31:8: error: 'll' has not been declared
   31 |  T rng(ll l, ll r) { if (l > r) return 0; return ge(r) - ge(l - 1); }
      |        ^~
shoes.cpp:31:14: error: 'll' has not been declared
   31 |  T rng(ll l, ll r) { if (l > r) return 0; return ge(r) - ge(l - 1); }
      |              ^~
shoes.cpp: In member function 'void fen<T>::upd(int, T)':
shoes.cpp:19:15: error: 'mxn' was not declared in this scope
   19 |   for (; g <= mxn; g += g&-g)
      |               ^~~
shoes.cpp:20:4: error: 'tr' was not declared in this scope
   20 |    tr[g] += k;
      |    ^~
shoes.cpp: In member function 'T fen<T>::ge(int)':
shoes.cpp:27:11: error: 'tr' was not declared in this scope
   27 |    res += tr[g];
      |           ^~
shoes.cpp: In function 'long long int count_swaps(std::vector<int>)':
shoes.cpp:37:10: error: 'cin' was not declared in this scope
   37 |    ll n; cin >> n;
      |          ^~~
shoes.cpp:5:1: note: 'std::cin' is defined in header '<iostream>'; did you forget to '#include <iostream>'?
    4 | #include <cassert>
  +++ |+#include <iostream>
    5 | 
shoes.cpp:38:14: error: declaration of 'std::vector<long long int> s' shadows a parameter
   38 |   vector<ll> s(2 * n);
      |              ^
shoes.cpp:34:40: note: 'std::vector<int> s' previously declared here
   34 | long long count_swaps(std::vector<int> s) {
      |                       ~~~~~~~~~~~~~~~~~^
shoes.cpp:65:21: error: no matching function for call to 'fen<long long int>::fen(ll)'
   65 |   fen<ll> tree(2 * n);
      |                     ^
shoes.cpp:7:8: note: candidate: 'constexpr fen<long long int>::fen()'
    7 | struct fen {
      |        ^~~
shoes.cpp:7:8: note:   candidate expects 0 arguments, 1 provided
shoes.cpp:7:8: note: candidate: 'constexpr fen<long long int>::fen(const fen<long long int>&)'
shoes.cpp:7:8: note:   no known conversion for argument 1 from 'll' {aka 'long long int'} to 'const fen<long long int>&'
shoes.cpp:7:8: note: candidate: 'constexpr fen<long long int>::fen(fen<long long int>&&)'
shoes.cpp:7:8: note:   no known conversion for argument 1 from 'll' {aka 'long long int'} to 'fen<long long int>&&'
shoes.cpp:74: note: '-Wmisleading-indentation' is disabled from this point onwards, since column-tracking was disabled due to the size of the code/headers
shoes.cpp:73:1: error: expected '}' at end of input
   73 | }
      | ^
shoes.cpp:34:43: note: to match this '{'
   34 | long long count_swaps(std::vector<int> s) {
      |                                           ^
shoes.cpp:38:21: warning: control reaches end of non-void function [-Wreturn-type]
   38 |   vector<ll> s(2 * n);
      |                     ^