Submission #43186

# Submission time Handle Problem Language Result Execution time Memory
43186 2018-03-10T13:14:02 Z jwvg0425 즐거운 사진 수집 (JOI13_collecting) C++14
Compilation error
0 ms 0 KB
class FenwickTree
{
public:
	FenwickTree(int k)
	{
		data.resize(k);
	}

	i64 sum(int n)
	{
		i64 ans = 0;

		while (n > 0)
		{
			ans += data[n];
			n -= (n & -n);
		}

		return ans;
	}

	void add(int n, i64 num)
	{
		while (n < data.size())
		{
			data[n] += num;
			n += (n & -n);
		}
	}

private:
	vector<i64> data;
};

Compilation message

collecting.cpp:9:2: error: 'i64' does not name a type
  i64 sum(int n)
  ^
collecting.cpp:22:18: error: 'i64' has not been declared
  void add(int n, i64 num)
                  ^
collecting.cpp:32:2: error: 'vector' does not name a type
  vector<i64> data;
  ^
collecting.cpp: In constructor 'FenwickTree::FenwickTree(int)':
collecting.cpp:6:3: error: 'data' was not declared in this scope
   data.resize(k);
   ^
collecting.cpp: In member function 'void FenwickTree::add(int, int)':
collecting.cpp:24:14: error: 'data' was not declared in this scope
   while (n < data.size())
              ^